me explico:
tengo esta funcion
Código PHP:
function getYouTubeFlv($url){
if ($html = file_get_contents($url)){
if(preg_match_all("/\b(?:video_id)\b:.*/", $html, $matches)){
$ref = $matches[0][0];
preg_match_all("/\'[^\'\\\\\r\n]*(?:\\\\.[^\'\\\\\r\n]*)*\'/", $ref, $match);
$id1 = str_replace("'", "", $match[0][0]);
$id2 = str_replace("'", "", $match[0][2]);
$id3 = str_replace("'", "", $match[0][3]);
$id = $id1.'&t='.$id2.'&sk='.$id3;
$url = 'http://youtube.com/get_video.php?video_id='.$id;
$url = get_headers($url);
//$url = print_r($url);
echo "$url[8]<br>";
$busqueda = array ('/Location: /');
$reemplazar = array ('');
$texto = preg_replace($busqueda, $reemplazar, $url[8]); //NO FUNCIONA
echo $texto;
//$url = trim($url[8],"Location:"); //NO FUNCIONA
//$url = substr($url,10); //NO FUNCIONA
echo "$url<br>";
return $url;
}
return false;
}
}
Location: http://chi-v252.chi.youtube.com/get_...id=cGa4vGJ2O7w
yo quiero quitar de delante ese Location:
he probado con substr y no va, con trim y no va, con preg_replace y no va...
es decir, si pongo:
Código PHP:
$url= "Location: http://chi-v252.chi.youtube.com/get_video?video_id=cGa4vGJ2O7w";
$url = trim($url,"Location: ");
Código PHP:
$url = trim([B]$url[8][/B],"Location: ");
Por que?'
como lo arreglo