1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| <?php
$usernameToken = array(
'email' => $username,
'password' => $password
);
$wsse_ns = "http://schemas.xmlsoap.org/ws/2002/07/secext";
$SoapVarUser = new SoapVar($username, XSD_STRING, NULL, $wsse_ns, NULL, $wsse_ns);
$SoapVarPass = new SoapVar($password, XSD_STRING, NULL, $wsse_ns, NULL, $wsse_ns);
$wsse_auth = new SoapVar($usernameToken, SOAP_ENC_OBJECT, NULL, $wsse_ns, 'AuthenticationHeader', $wsse
$header=new SoapVar($wsse_auth, SOAP_ENC_OBJECT, NULL, $wsse_ns, 'Security', $wsse_ns);
$wsse_header = new SoapHeader($wsse_ns, 'AuthenticationHeader', $header, true);
//Then you are able to execute any user remote procedure calls:
$wsdl = "https://api3.popfax.com/?service=Popfax&wsdl";
$client = new SoapClient($wsdl);
$client->__setSoapHeaders(array($wsse_header));
$response = $client->__SoapCall('PopfaxService.getAccountInfo',array());
?> |
Partager