Read One URl Parameter using php -


i want read 1 parameter specific url :

like : http://www.youtube.com/watch?v=mroil74p-9e&feature=watch

output should : mroil74p-9e

i try search , found function :

function remove_query_part($url, $term) {     $query_str = parse_url($url, php_url_query);     if ($frag = parse_url($url, php_url_fragment)) {         $frag = '#' . $frag;     }     parse_str($query_str, $query_arr);     unset($query_arr[$term]);     $new = '?' . http_build_query($query_arr) . $frag;     return str_replace(strstr($url, '?'), $new, $url); } 

this function remove 1 parameter , return rest. can edit function return video id , ignore whatever else in url.

$query_str = parse_url($url, php_url_query); parse_str($query_str, $args);  print $args['v'];   // <- mroil74p-9e 

i think know how put function...


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -