I'm experiencing an issue that causes YouTube to load in Filipino rather than English. Everything has been working fine for the past 6 months up until today. My web server is hosted in the US and all the IP addresses point to Texas. I'm loading a YouTube page with PHP on this site: http://getlikes.us/testget.php
$youtubeURL = "https://www.youtube.com/watch?v=8To-6VIJZRE";
$data = file_get_contents($youtubeURL);
echo $data;
Which results in the page loading in Filipino:
I'm unsure where to go from here. What is causing YouTube to think the region is the Philippines?
Not sure why it is doing that, maybe their algorithm has a glitch or your server is sending something strange. That server is in TX, US and the IPs are registered to a TX, US block.
You might need to send an Accept-Language
header with stream_context_create()
and use the stream context in file_get_contents()
:
$opts = array('http'=>array('method'=>"GET",
'header'=>"Accept-language: en\r\n"
)
);
$context = stream_context_create($opts);
$youtubeURL = "https://www.youtube.com/watch?v=8To-6VIJZRE";
$data = file_get_contents($youtubeURL, false, $context);
echo $data;