I am trying to do the following
$url = "http://halo-video.com/drama/ha";
$data = file_get_contents($url);
echo $data;
it give me a blank page or a 500 internal error, I tried load the site with my computer, and its load fine.
I am trying to do the following
$url = "http://halo-video.com/drama/ha";
$data = file_get_contents($url);
echo $data;
it give me a blank page or a 500 internal error, I tried load the site with my computer, and its load fine.
EDIT:
Ok, this was bugging me so figured out a fix.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://kissanime.com/Anime/Karneval');
curl_setopt($ch, CURLOPT_USERAGENT, 'myuseragent');
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_REFERER, "http://www.test.com");
$html = curl_exec($ch);
curl_close($ch);
echo $html;
This code works and fixed the redirect errors I was getting. Happy content grabbing.
although reason could be different but my code (similar to yours) works fine so just append these lines into yours at appropriate places,
$useragent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; nl; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7";
curl_setopt($s,CURLOPT_AUTOREFERER, true);
curl_setopt($s,CURLOPT_FOLLOWLOCATION, true);
curl_setopt($s,CURLOPT_MAXREDIRS, 5);
curl_setopt($s,CURLOPT_RETURNTRANSFER, true);
curl_setopt($s, CURLOPT_HEADER, true);
Use file() instead of file_get_contents()
$url = "http://kissanime.com/Anime/Karneval";
$data = file($url);
echo htmlspecialchars($data);