Danny620 Posted January 17, 2011 Share Posted January 17, 2011 Hi, I want to be able to extract a piece of information out of a url for example ==== I want to extract this part CgRyVUsI8mU Link to comment https://forums.phpfreaks.com/topic/224751-url-php/ Share on other sites More sharing options...
guyfromfl Posted January 17, 2011 Share Posted January 17, 2011 Are you trying to actually get the hash from youtube or are you trying to figure out the variable you are passing in your project? Like at youtube their code might look something like this: $video = $_GET['v']; echo $video; if you are trying to get the string after v= in the url you would need something like: strstr($url, 'v=') Link to comment https://forums.phpfreaks.com/topic/224751-url-php/#findComment-1160913 Share on other sites More sharing options...
AbraCadaver Posted January 17, 2011 Share Posted January 17, 2011 parse_str(parse_url($url, PHP_URL_QUERY), $vars); echo $vars['v']; //or parse_str(parse_url($url, PHP_URL_QUERY)); echo $v; Link to comment https://forums.phpfreaks.com/topic/224751-url-php/#findComment-1160919 Share on other sites More sharing options...
Danny620 Posted January 17, 2011 Author Share Posted January 17, 2011 haha why did'tn i spot this myself lmao Link to comment https://forums.phpfreaks.com/topic/224751-url-php/#findComment-1161027 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.