3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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; } } } ?>
based on 8NTvh
Output for 7.0.0 - 7.2.0
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; SoapClientEMS has a deprecated constructor in /in/gk98g on line 5 Fatal error: Class 'SoapClient' not found in /in/gk98g on line 5
Process exited with code 255.
Output for 5.5.0 - 5.6.28
Fatal error: Class 'SoapClient' not found in /in/gk98g on line 6
Process exited with code 255.