Skip to content

Instantly share code, notes, and snippets.

@samuel-fonseca
Forked from akalongman/php-soap.php
Created May 10, 2017 19:44
Show Gist options
  • Save samuel-fonseca/25c1f120ef4c91d2a964e69ceff4beee to your computer and use it in GitHub Desktop.
Save samuel-fonseca/25c1f120ef4c91d2a964e69ceff4beee to your computer and use it in GitHub Desktop.
PHP soap client example
ini_set('soap.wsdl_cache_enabled', 0);
ini_set('soap.wsdl_cache_ttl', 900);
ini_set('default_socket_timeout', 15);
$params = array('param1'=>$param1);
$wsdl = 'http://service_url/method?WSDL';
$options = array(
'uri'=>'http://schemas.xmlsoap.org/soap/envelope/',
'style'=>SOAP_RPC,
'use'=>SOAP_ENCODED,
'soap_version'=>SOAP_1_1,
'cache_wsdl'=>WSDL_CACHE_NONE,
'connection_timeout'=>15,
'trace'=>true,
'encoding'=>'UTF-8',
'exceptions'=>true,
);
try {
$soap = new SoapClient($wsdl, $options);
$data = $soap->method($params);
}
catch(Exception $e) {
die($e->getMessage());
}
var_dump($data);
die;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment