1

i want to try calling soap method in php with curl function but it showing one warning

Warning: curl_setopt() [function.curl-setopt]: Invalid curl configuration option in /home/bestbus/public_html/apitest.php on line 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

3 Answers 3

1

According the manual, the only valid values for CURLOPT_SSL_VERIFYHOST are 1 or 2, and the use of 1 has been removed in cURL 7.28.1

  • 1 to check the existence of a common name in the SSL peer certificate.
  • 2 to check the existence of a common name and also verify that it matches the hostname provided. In production environments the value of this option should be kept at 2 (default value).
Sign up to request clarification or add additional context in comments.

Comments

0

Try this one:

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

Comments

0

Try replacing

 curl_setopt($ch, CURLOPT_MUTE, 1);

with

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

because as of documentation http://php.net/manual/en/function.curl-setopt.php CURLOPT_MUTE is removed in cURL 7.15.5

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.