【问题标题】:PHP7 SoapClient verify_peer_name: SOAP Error: Could not connect to hostPHP7 SoapClient verify_peer_name:SOAP 错误:无法连接到主机
【发布时间】:2016-08-06 07:41:13
【问题描述】:

我的 Paypal 代码未使用 verify_peer_name => true 选项运行。当我使用选项 false 尝试相同的 Soap 请求时,它可以工作,对我来说似乎是 PHP7 错误?这适用于 PHP5.3。 我总是得到错误:

无法连接到主机

我已经在我的服务器上安装了证书,我也可以毫无问题地卷曲 url,只有 SoapClient 没有按预期工作。

有谁知道,参数 verify_peer_name 的真正作用是什么?

$client = new SoapClient("https://xxx.paypal/the.wsdl",
    array(
        "trace" => 1,
        "location" => "https://xxx.paypal/the.wsdl",
        'exceptions' => 1,
        "stream_context" => stream_context_create(
            array(
                'ssl' => array(
                    'verify_peer'       => true,
                    'verify_peer_name'  => true,
                )
            )
        )
    ) 
);

【问题讨论】:

    标签: php curl soap paypal php-7


    【解决方案1】:

    我发现了 verify_peer_name 并得到了这个.. 检查它是否可以帮助你: peer_name 字符串

    Peer name to be used. If this value is not set, then the name is guessed based on the hostname used when opening the stream.
    

    verify_peer 布尔值

    Require verification of SSL certificate used.
    
    Defaults to TRUE.
    

    verify_peer_name 布尔值

    Require verification of peer name.
    
    Defaults to TRUE.
    

    【讨论】:

    • 谢谢,但是 verify_peer_name 选项究竟检查了什么?
    • 它需要验证,如果你不验证对等方意味着你的 SSL 连接不安全,因为你没有验证它给你的信息。
    • 对不起,那是错误的。 verify_peer 验证证书,verify_peer_name 做其他事情......
    • 我试图找到关于 verify_peer_name 并找到相同的结果。因此,如果您找到任何其他答案,请告诉我。
    • peer_name 参数是什么?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-20
    • 2011-03-29
    • 1970-01-01
    • 1970-01-01
    • 2017-07-03
    相关资源
    最近更新 更多