<?php
<?php
// Extends SoapClient (PHP native) for EMS authentication process
class SoapClientEMS extends SoapClient
{
const EMS_WS_NAMESPACE = 'http://ws.ems6.net/';
function SoapClientEMS($Login, $Password, $Idmlist, $wsdl, $options = array())
{
parent::__construct($wsdl, $options);
$this->__setSoapHeaders($this->createHeader($Login, $Password, $Idmlist));
}
private function createHeader($Login, $Password, $Idmlist)
{
@$struct->UserName = new SoapVar($Login, XSD_STRING, null, null, null, self::EMS_WS_NAMESPACE);
$struct->Password = new SoapVar($Password, XSD_STRING, null, null, null, self::EMS_WS_NAMESPACE);
$struct->IdMlist = new SoapVar($Idmlist, XSD_INTEGER, null, null, null, self::EMS_WS_NAMESPACE);
$header_values = new SoapVar($struct, SOAP_ENC_OBJECT, null, null,null, self::EMS_WS_NAMESPACE);
$header = new SoapHeader(self::EMS_WS_NAMESPACE, "AuthHeader", $header_values);
return $header;
}
}
// declare variables for soap authentication
// API LOGIN
$Login = 'Email_API';
// API SECRET
$Pwd = 'i8piZZa4u';
// DATABASE
$Idmlist = '2093191961';
$mySegment = new SoapClientEMS( $Login, $Pwd, $Idmlist, "https://api.cheetahmail.fr/v1/segment.asmx?WSDL", $Options = array());
// WebMethod call
$result = $mySegment->ListSegment();
//Affichage du Results brut
if(isset($result->ListSegmentResult->string)){
if(count($result->ListSegmentResult->string) == 1){
echo $result->ListSegmentResult->string;
}
else{
foreach ($result->ListSegmentResult->string as $segment) {
echo $segment;
}
}
}
?>
- Output for 7.0.0 - 7.0.2
- Parse error: syntax error, unexpected '<', expecting end of file in /in/8NTvh on line 3
Process exited with code 255. - Output for 5.5.24 - 5.5.31, 5.6.8 - 5.6.17
- Parse error: syntax error, unexpected '<' in /in/8NTvh on line 3
Process exited with code 255.
preferences:
165.52 ms | 1395 KiB | 28 Q