首页 文章

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

提问于
浏览
1

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

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

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

curl_getinfo result:

localhost:Array([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 [upload_content_length] => 479 [uploadtransfer_length] => 393 [redirect_time] => 0 [redirect_url] => [primary_ip] => 175.139.27.203 [certinfo] = > Array()[primary_port] => 2016 [local_ip] => 192.168.1.102 [local_port] => 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] =>数组( ))

curl call:

$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 回答

  • 1

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

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

相关问题