PHP中的CURL是否支持SPDY?
I am using cURL in PHP to connect to different APIs that I know use SPDY the new protocol from Google.
But I am unsure if by default PHP cURL supports SPDY. And if it is not is there a way to configure it so that it supports SPDY?
我在PHP中使用cURL来连接不同的API,我知道这些API使用SPDY来自Google的新协议。 p>
但我不确定默认情况下PHP cURL是否支持SPDY。 如果不是,有没有办法配置它,以便它支持SPDY? p> div>
on my system with PHP 5.5.19, and curl 7.39.0 , the answer is no. You can check what your curl support, by enabling "automatic" encoding, making curl list all supported encodings to the server (enable automatic by CURLOPT_ENCODING->empty string), then check the headers sent by curl, like this:
<?php
if(array_key_exists("curlcall",$_GET)){
if(is_callable("http_get_request_headers")){
var_dump(http_get_request_headers());
}elseif(is_callable("apache_request_headers")){
var_dump(apache_request_headers());
} else {
throw new Exception("unsupported enviroment (both http_get_request_headers and apache_request_headers missing!)");
}
} else {
$ch=curl_init("http://127.0.0.1/a.php?curlcall");
curl_setopt($ch,CURLOPT_ENCODING,"");
curl_exec($ch);
}
on my system, i get this output:
array(3) { ["Host"]=> string(9) "127.0.0.1" ["Accept"]=> string(3) "*/*"
["Accept-Encoding"]=> string(13) "deflate, gzip" }
meaning that deflate and gzip (and the default - no encoding/plain) is supported (no SPDY support yet im afriad)