Return to Snippet

Revision: 55248
at January 31, 2012 14:03 by fetz


Initial Code
$str = '<iframe width="560" height="315" src="http://www.youtube.com/embed/GHcUkc4tshA?rel=0" frameborder="0" allowfullscreen></iframe>';
$findme   = 'http://';
$nextFind = '?';
$next2Find = '"';
$posHttp = strpos($str, $findme);
$pos1 = strpos($str, $nextFind, $posHttp);
$pos2 = strpos($str, $next2Find, $posHttp);
	
if($pos1 < $pos2 && $pos1 != -1) {
	echo substr($str, $posHttp, $pos1-$posHttp);
}else {
	echo substr($str, $posHttp, $pos2-$posHttp);
}

Initial URL


Initial Description
need to get the url from a youtube/vimeo embedded code without the querystring's

Initial Title
Get url from string

Initial Tags
url

Initial Language
PHP