Çekim yaptığım sitede yapılan yönlendirme yüzünden file_get_contents'te bu hatayı alıyorum. Curl ile aşmaya denedim olmadı.
function getir($url){
$oturum = curl_init();
curl_setopt($oturum, CURLOPT_URL, $url);
$h4 = $_SERVER['HTTP_USER_AGENT'];
curl_setopt($oturum, CURLOPT_USERAGENT, $h4);
curl_setopt($oturum, CURLOPT_HEADER, 0);
curl_setopt($oturum, CURLOPT_RETURNTRANSFER, true);
$source=curl_exec($oturum);
curl_close($oturum);
return $source;
}
Böyle denermisiniz
function getir($url, $post=false){
$user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, $post ? true : false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post ? $post : false);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
$row = curl_exec($ch);
curl_close($ch);
return $row;
}