Jump to content

PHP Explode Function Help


prolinu

Recommended Posts

My Programmer used this code to strip out characters expect the youtube ID in order to create the thumbnail picture of youtube video.

 

For a youtube link like: src="http://www.youtube.com/watch?v=XrL5YIsUQu0"

 

He used this code:

$colony 	= explode("src=",$videoembed);
		$colonized 	= explode("/",$colony[1]);
		$colonizer 	= explode("\"",$colonized[4]);
                        $coloni         = explode("&",$colonizer[4]);
		$thumb_name	= "http://img.youtube.com/vi/".$colonizer[0]."/default.jpg";

So that thumbnail image URL result will be http://img.youtube.com/vi/XrL5YIsUQu0/default.jpg

 

Now Youtube has additional strings with src=link. I am not able to explode the addition strings by using above method.

 

Now Youtube link look like this: src="http://www.youtube.com/watch?v=XrL5YIsUQu0&hl=en&fs=1&rel=0"

 

How to strip out &hl=en&fs=1&rel=0 after the youtube video ID by using same above method?

 

Now youtube thumbnail image link comes like this:

http://img.youtube.com/vi/XrL5YIsUQu0&hl=en&fs=1&rel=0/default.jpg

 

I want it as http://img.youtube.com/vi/XrL5YIsUQu0/default.jpg

 

Your help will be appreciated.

Link to comment
https://forums.phpfreaks.com/topic/164840-php-explode-function-help/
Share on other sites

We're here to help people with code they have having troubles writing, not for writing the code for people. You can use the freelance section of the site for that. Or else you can have your developer come here and show us what he has already written, and we can help him with whatever problems he is having.

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.