2013-03-14 23 views
0

我想嘗試調用,捲曲功能的PHP肥皂的方法,但它顯示一個警告調用SOAP方法與PHP的捲曲功能

警告:curl_setopt()[function.curl-SETOPT]:無效的捲曲線在/home/bestbus/public_html/apitest.php配置選項26

<? 

$xml_data ='<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:rsr="http://webservices.foxfireindia.com/RSRSAPI"> 
    <soap:Header> 
    <rsr:LinkCredentials> 
    <!--Optional:--> 
    <rsr:Login>***main</rsr:Login> 
    <!--Optional:--> 
    <rsr:Password>****@3api</rsr:Password> 
    </rsr:LinkCredentials> 
</soap:Header> 
    <soap:Body> 
    <rsr:Login> 
     <!--Optional:--> 
     <rsr:userName>***main</rsr:userName> 
    <!--Optional:--> 
    <rsr:password>****@3api</rsr:password> 
    </rsr:Login> 
    </soap:Body> 
</soap:Envelope>'; 

$URL = "http://115.254.89.1:8090/RSRS_APITest/RSRSAPI.asmx?wsdl"; 

$ch = curl_init($URL); 
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, "$xml_data"); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
$output = curl_exec($ch); 

print_r($output); 
curl_close($ch); 

?> 
+0

第26行在哪裏? – Passerby 2013-03-14 10:24:48

回答

1

根據manual,用於CURLOPT_SSL_VERIFYHOST唯一有效的值是1或2,以及使用1已經在捲曲除去7.28.1

  • 1檢查SSL對等證書中是否存在公共名稱。
  • 2檢查是否存在通用名稱並驗證它是否與所提供的主機名相匹配。在生產環境中,此選項的值應保持爲2(默認值)。
0

嘗試這一個:

<?php 
    $xml_data = '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:rsr="http://webservices.foxfireindia.com/RSRSAPI"> 
    <soap:Header> 
    <rsr:LinkCredentials> 
    <!--Optional:--> 
    <rsr:Login>***main</rsr:Login> 
    <!--Optional:--> 
    <rsr:Password>****@3api</rsr:Password> 
    </rsr:LinkCredentials> 
</soap:Header> 
    <soap:Body> 
    <rsr:Login> 
     <!--Optional:--> 
     <rsr:userName>***main</rsr:userName> 
    <!--Optional:--> 
    <rsr:password>****@3api</rsr:password> 
    </rsr:Login> 
    </soap:Body> 
</soap:Envelope>'; 

    $URL = "http://115.254.89.1:8090/RSRS_APITest/RSRSAPI.asmx?wsdl"; 
    $header = array(
        "Content-type: text/xml;charset=\"utf-8\"", 
        "Accept: text/xml", 
        "Cache-Control: no-cache", 
        "Pragma: no-cache", 
        "SOAPAction: \"run\"", 
        "Content-length: ".strlen($tresc), 
        ); 

    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL,   $URL); 
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); 
    curl_setopt($ch, CURLOPT_TIMEOUT,  10); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
    curl_setopt($ch, CURLOPT_POST,   true); 
    curl_setopt($ch, CURLOPT_POSTFIELDS,  $xml_data); 
    curl_setopt($ch, CURLOPT_HTTPHEADER,  $header); 

    $output = curl_exec($ch); 
    print_r($output); 
    curl_close($ch); 
?>