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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.