Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

How to call soap api in php using curl method

<pre>
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => 
  "<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
  <Body>
      <ListOfContinentsByCode xmlns="http://www.oorsprong.org/websamples.countryinfo"/>
  </Body>
</Envelope>",
  CURLOPT_HTTPHEADER => array("content-type: text/xml"),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
?>
</pre>
//call soap API in php
Source by techtechinfo.com #
 
PREVIOUS NEXT
Tagged: #How #call #soap #api #php #curl #method
ADD COMMENT
Topic
Name
7+3 =