Thursday, 13 October 2016

unable to send user to other page php

i have a code that fetch a movie trailler and create a youtube url. everything is work ok except when it's time to open it in the browser, here the code




if (isset($_POST['link'])){
$arr1 = $_POST['link'];
$movieName = str_replace(' ', '+', $arr1[0]);
$movieYear = $arr1[1];
$page = file_get_contents('http://www.youtube.com/results?search_query='.$movieName.'+'.$movieYear.'+trailer&aq=1&hl=en');
if($page){
if(preg_match('~~s', $page, $matches))
$youtubelink = "http://www.youtube.com/v/" . $matches[1];
header("Location: '".$youtubelink."'");

}
else
{
echo "Trailler not found";
}
}


When i press the button, it does not send me to the youtube link, i know that the link is good cause when i erase the header code and echo the $youtubelink, it is the good address.




Thanks



Edit:
I end up with this:



echo "";

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...