PHP cURL如何检查我的请求是否被阻止?

时间:2017-10-24 17:01:49

标签: php web-services curl

我在此asmx网址上使用cURL:http://ltcmobile.webhop.biz:2016/ereloadws/service.asmx 在localhost中成功,但是当我将文件上传到我的实时服务器时,它将返回bool(false)

但是我尝试将提交的URL和我的请求更改为其他asmx URL,我尝试了http://www.webservicex.net/globalweather.asmx,它确实可以在localhost和live server上运行。

这是否意味着http://ltcmobile.webhop.biz:2016/ereloadws/service.asmx阻止了我的连接?无论如何,我可以检查并确认这个吗?

curl_getinfo结果:

本地主机: 数组([url] => http://ltcmobile.webhop.biz:2016/ereloadws/service.asmx [content_type] => text / xml; charset = utf-8 [http_code] => 200 [header_size] => 230 [request_size] => 525 [ filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.109 [namelookup_time] => 0 [connect_time] => 0.063 [pretransfer_time] => 0.063 [ size_upload] => 393 [size_download] => 479 [speed_download] => 4394 [speed_upload] => 3605 [download_content_length] => 479 [upload_content_length] => 393 [starttransfer_time] => 0.109 [redirect_time ] => 0 [redirect_url] => [primary_ip] => 175.139.27.203 [certinfo] =>数组()[primary_port] => 2016 [local_ip] => 192.168.1.102 [local_port] =&gt ; 52286)

直播服务器: 数组([url] => http://ltcmobile.webhop.biz:2016/ereloadws/service.asmx [content_type] => [http_code] => 0 [header_size] => 0 [request_size] => 0 [filetime] => -1 [ssl_verify_result ] => 0 [redirect_count] => 0 [total_time] => 0 [namelookup_time] => 9.7E-5 [connect_time] => 0 [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 [redirect_url] => [primary_ip] => 175.139.27.203 [certinfo] =>数组())

卷曲电话:

$xml_data = '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
   <SendRequest xmlns="http://tempuri.org/">
     <ResellerAccount>*******</ResellerAccount>
     <RefNum>******</RefNum>
   </SendRequest>
</soap:Body>
</soap:Envelope>';

$URL = "http://ltcmobile.webhop.biz:2016/ereloadws/service.asmx";

$ch = curl_init($URL);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml; charset=utf-8'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);

var_dump($output);

提前致谢!

1 个答案:

答案 0 :(得分:1)

根据你的curl_getinfo输出,似乎你的服务器端请求看起来不像是在旅行。还要看看curl_error,看看它的内容。

您的服务器可能存在出站通信问题。 2016年的端口是否在您的服务器上打开?你(从服务器)ping 175.139.27.203吗?