Jump to content

extract youtube.com variables from a comment


fluxadd

Recommended Posts

hello,

 

I want to extract a youtube video variable from users comments, i make a simple function but it works just for one url, if they posted more urls in the same comment, it will return just the first video.

 

this is what i've done before now:

function get_youtube ($youtube){
       $findme   = 'youtube.com/watch?v=';
       $pos = strpos($youtube, $findme);
       if ($pos !== false) { 
       parse_str( parse_url( $youtube, PHP_URL_QUERY )); 
        echo $v;   
	 }   
 }

 

How can I make to extract all the $v  from a comment with more url?

 

THX

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.