Benim kod file_get_contents() bir API nokta için GET isteklerini yapmak için kullanıyor. Bu HTTP/1.0 kullanıyor ve benim sysadmin ben kullanmanız gerektiğini söylüyor gibi görünüyor HTTP/1.1. Nasıl bir HTTP/1.1 isteği yapabilir? Ben curl kullanmak gerekir veya daha iyi / daha kolay bir yolu var mı?
Update
Ben PHP 5.1.6 kullanıyorum çünkü cURL kullanmaya karar verdi. Bunu yaparak HTTP/1.1 zorlayarak sona erdi:
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
Daha sonra 5.3 kullanıyorsanız ya da eğer böyle bir şey yapıyor denedim:
$ctx = stream_context_create(array(
'http' => array('timeout' => 5, 'protocol_version' => 1.1)
));
$res = file_get_contents($url, 0, $ctx);
echo $res;
http://us.php.net/manual/en/context.http.php
Note: PHP prior to 5.3.0 does not implement chunked transfer decoding. If this value is set to 1.1 it is your responsibility to be 1.1 compliant.
Ben HTTP/1.1 sağlayabilir hangi bulunan başka bir seçenek kullanmak için HTTP extension