Уже тонну времени мучаюсь с данной проблемой.
Код:
<?php
$url = 'https://yastatic.net/morda-logo/i/citylogos/kulikovo2015-logo-ru.png';
$ch = curl_init();
# boolean
curl_setopt($ch, CURLOPT_CRLF, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
# integer
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
# string
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_USERAGENT, (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2224.3 Safari/537.36'));
#
$r = array(
'info' => curl_getinfo($ch),
'data' => curl_exec($ch)
);
curl_close($ch);
print_r($r['info']);
?>
Вывод:
Array
(
[url] => https://yastatic.net/morda-logo/i/citylogos/kulikovo2015-logo-ru.png
[content_type] =>
[http_code] => 0
[header_size] => 0
[request_size] => 0
[filetime] => 0
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0
[namelookup_time] => 0
[connect_time] => 0
[pretransfer_time] => 0
[size_upload] => 0
[size_download] => 0
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => -1
[upload_content_length] => -1
[starttransfer_time] => 0
[redirect_time] => 0
[certinfo] => Array
(
)
[primary_ip] =>
[primary_port] => 0
[local_ip] =>
[local_port] => 0
[redirect_url] =>
)
PHP 5.4.35
cURL 7.39.0
Apache/2.2.29 (Win32)
и
PHP 5.3.29
Apache/2.2.22 (Linux 3.10.82 x64)
cURL 7.22.0
Толи лыжи, толи я. Не исключаю что глаз замылился или я просто туплю уже от созерцания километров кода. Но реально не могу понять "почему раньше работало, а сейчас нет".