dsh84723 2014-12-22 17:01
浏览 34
已采纳

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?

  • 写回答

1条回答 默认 最新

  • dounie5475 2015-02-24 22:25
    关注

    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)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计