doujiepin5547 2013-09-10 10:46
浏览 41

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

I had a PHP script which was communicating with a third party API to send them order information using PHP CURL and SOAP. But now there is absolutely zero response from it. We changed servers a while back but my host has ran some tests to see the extensions are all working. Here's some code and debug:

            $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 );

The print_r produces this:

Array ( [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] => Array ( ) [primary_ip] => XXX.249.XXX.218 [primary_port] => 443 [local_ip] => XX.174.XX.11 [local_port] => 44560 [redirect_url] => )

Does that not suggest they are not responding with anything or is it a problem my end?

My web host set up this test script to prove a point:

<?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);
?> 

And out pops:

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

So is it my code, my server, or the API's server acting up?

  • 写回答

1条回答 默认 最新

  • douyiqi9640 2013-09-13 09:54
    关注

    OK I finally got my answer, suggested by my web host. SSL version needed setting, not automatically determining by PHP:

    curl_setopt($ch, CURLOPT_SSLVERSION, 3);
    

    Thank you to everyone who looked and helped.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度