douzi2749 2018-08-01 17:24
浏览 221

PHP是否支持使用HTTP / 2协议创建流上下文?

In the current PHP documentation or elsewhere, I could not find anything about HTTP protocol version 2 when creating a stream context.

Is the usage transparent, or must special features of HTTP/2 be taken into account? Does the use of HTTP/2 in the context of streams make any sense?

I am aware that CURL would handle all this for me - but I do not want to use CURL.

Here is a small example with FOPEN:

$context = [
    "http" => [
        "header" => [
            "Accept-encoding: gzip, deflate",
            "Connection: close",
            "Upgrade-insecure-requests: 1",
            "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
            "Dnt: 1",
            "Accept-language: en-us",
            "Content-type: text/html"
        ],
        "ignore_errors" => true,
        "max_recirects" => 3,
        "method" => "POST",
        "protocol_version" => 2.0,
        "timeout" => 30.0,
        "content" => ""
    ],
    "ssl" => [
        "disable_compression" => false,
        "verify_peer" => true,
        "verify_depth" => 5,
        "SNI_enabled" => true
    ]
];

$stream = stream_context_create($context);
$result = fopen(base64_decode(self::URL), "rb", false, $stream);
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 腾讯企业邮箱邮件可以恢复么
    • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
    • ¥15 错误 LNK2001 无法解析的外部符号
    • ¥50 安装pyaudiokits失败
    • ¥15 计组这些题应该咋做呀
    • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
    • ¥15 让node服务器有自动加载文件的功能
    • ¥15 jmeter脚本回放有的是对的有的是错的
    • ¥15 r语言蛋白组学相关问题
    • ¥15 Python时间序列如何拟合疏系数模型