这个PHP CURL / SOAP脚本发生了什么?

时间:2013-09-10 10:46:41

标签: php xml api soap curl

我有一个PHP脚本,它与第三方API通信,使用PHP CURL和SOAP发送订单信息。但现在它的回应绝对没有。我们改变了服务器,但我的主机已经运行了一些测试,看看扩展程序都在运行。这是一些代码和调试:

            $ch = curl_init($this->apiUrl);
            //curl_setopt($ch, CURLOPT_MUTE, 1);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
            curl_setopt($ch, CURLOPT_POSTFIELDS, "$this->xmlRequest");
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            $this->getCertificateXMLResponse = curl_exec($ch);  

            $aCURLinfo = curl_getInfo( $ch );
            print_r( $aCURLinfo );

print_r产生了这个:

  

数组([url] => https://www.theirdomain.com/theirdomain/Service/InsWebService.asmx [content_type] => [http_code] => 0 [header_size] => 0 [request_size] => 0 [filetime] => - 1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.024002 [namelookup_time] => 0.001417 [connect_time] => 0.024017 [pretransfer_time] => 0 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => -1 [upload_content_length] => -1 [starttransfer_time] => 0 [redirect_time] => 0 [certinfo] =>数组()[primary_ip] => XXX.249.XXX.218 [primary_port] => 443 [local_ip] => XX.174.XX.11 [local_port] => 44560 [redirect_url] =>)

这不是暗示他们没有回应任何事情,或者这是我的问题吗?

我的网站托管服务商设置了此测试脚本以证明这一点:

<?php
// create a new cURL resource
$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://www.example.com");
curl_setopt($ch, CURLOPT_HEADER, 0);

// grab URL and pass it to the browser
curl_exec($ch);

$aCURLinfo = curl_getInfo( $ch );
      print_r( $aCURLinfo );


// close cURL resource, and free up system resources
curl_close($ch);
?> 

然后弹出:

  

数组([url] =&gt; http://www.example.com [content_type] =&gt; text / html [http_code] =&gt; 200 [header_size] =&gt; 322 [request_size] =&gt; 54 [filetime] = &gt; -1 [ssl_verify_result] =&gt; 0 [redirect_count] =&gt; 0 [total_time] =&gt; 0.627453 [namelookup_time] =&gt; 0.429159 [connect_time] =&gt; 0.52812 [pretransfer_time] =&gt; 0.52816 [size_upload] = &gt; 0 [size_download] =&gt; 1270 [speed_download] =&gt; 2024 [speed_upload] =&gt; 0 [download_content_length] =&gt; 1270 [upload_content_length] =&gt; 0 [starttransfer_time] =&gt; 0.627415 [redirect_time] =&gt; ; 0 [certinfo] =&gt; Array()[primary_ip] =&gt; 93.184.216.119 [primary_port] =&gt; 80 [local_ip] =&gt; 79.174.170.11 [local_port] =&gt; 45182 [redirect_url] =&gt;)

我的代码,服务器或API的服务器是否正常运行?

1 个答案:

答案 0 :(得分:1)

好的,我终于得到了我的答案,我的网站主持人建议。 SSL版本需要设置,而不是由PHP自动确定:

curl_setopt($ch, CURLOPT_SSLVERSION, 3);

感谢所有寻求帮助的人。