在服务器上启用Curl时,卷曲无法连接到主机

时间:2016-01-30 15:55:46

标签: php web-services curl localhost

我使用curl调用web服务,它在localhost中正常工作但是当我在我的实时网站上使用相同的脚本来调用它时输出错误:

  

无法连接到主机

以下是我的Live网站卷曲设置 enter image description here

 $soap_request = '<?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>
    <InsertData xmlns="http://exampleServiceSite:6265">          
      <remarks>No Remarks</remarks>
      <insuranceValue>0</insuranceValue>
    </InsertData>
    </soap:Body>
    </soap:Envelope>';

$header = array(
    "POST /Service1.asmx HTTP/1.1",
        "Content-type: text/xml;charset=\"utf-8\"",
        "Accept: text/xml",
        "Cache-Control: no-cache",
        "Pragma: no-cache",
        "SOAPAction: \"http://exampleServiceSite:6265/InsertData\"",
        "Content-length: ".strlen($soap_request),
    );

    $soap_do = curl_init();
        curl_setopt($soap_do, CURLOPT_URL,            "http://exampleServiceSite:6265/" );
        curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
        curl_setopt($soap_do, CURLOPT_POST,           true );
        curl_setopt($soap_do, CURLOPT_POSTFIELDS,     $soap_request);
        curl_setopt($soap_do, CURLOPT_HTTPHEADER,     $header);
        $result = curl_exec($soap_do);
        var_dump($result);

1 个答案:

答案 0 :(得分:1)

您是否拥有对开发机器的SSH访问权限?

如果是这样,请打开SSH会话并尝试:

>telnet exampleServiceSite 6265

你能得到这样的东西吗?

Trying 62.253.72.158...
Connected to google.com.
Escape character is '^]'.