3v4l.org

run code in 300+ PHP versions simultaneously
<?php try { $url = "https://ri.test.msb.se/RapportServiceWS.svc?wsdl"; $client = new SoapClient($url, array('soap_version' => SOAP_1_1, 'location' => 'https://ri.test.msb.se/RapportServiceWS.svc/basicHttpBinding', 'exceptions' => 1, 'trace' => 1 )); $headers = array(); function guid() { mt_srand((double)microtime()*10000);//optional for php 4.2.0 and up. $charid = strtoupper(md5(uniqid(rand(), true))); $hyphen = chr(45); $uuid = 'uuid'.$hyphen .substr($charid, 0, 8).$hyphen .substr($charid, 8, 4).$hyphen .substr($charid,12, 4).$hyphen .substr($charid,16, 4).$hyphen .substr($charid,20,12).$hyphen.'1'; return $uuid; } function generate_header() { $WSSE_NS = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'; $WSSE_PFX = 'wsse'; $WSU_NS = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'; $WSU_PFX = 'wsu'; $PASSWORD_TYPE = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText'; $username = 'TestProgram'; $password = 'jtKLGpaKZ9XqmA40QGo'; $currentTime = time(); $timestamp=gmdate('Y-m-d\TH:i:s', $currentTime).'Z'; $expiretimestamp=gmdate('Y-m-d\TH:i:s', $currentTime + 300).'Z'; $nonce=mt_rand(); $passdigest=base64_encode(pack('H*',sha1(pack('a*',$password)))); $header=' <wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="'.$WSSE_NS.'" xmlns:wsu="'.$WSU_NS.'"> <wsu:Timestamp wsu:Id="_0"> <wsu:Created>'.$timestamp.'</wsu:Created> <wsu:Expires>'.$expiretimestamp.'</wsu:Expires> </wsu:Timestamp> <wsse:UsernameToken wsu:Id="'.guid().'"> <wsse:Username>'.$username.'</wsse:Username> <wsse:Password Type="'.$PASSWORD_TYPE.'">'.$password.'</wsse:Password>'. '</wsse:UsernameToken>'. '</wsse:Security>'; $headerSoapVar=new SoapVar($header,XSD_ANYXML); $soapheader=new SoapHeader($WSSE_NS, "Security" , $headerSoapVar , true); return $soapheader; } $headers[] = generate_header(); $client->__setSoapHeaders($headers); $params = array(); $pingresult = $client->Ping($params); echo $pingresult->PingResult; var_dump($pingresult); } catch (SoapFault $e) { echo($e->getMessage()); echo '<br><br>'; echo($e); } catch (Exception $err) { echo ($e->getMessage()); echo '<br><br>'; echo($err); } ?>

preferences:
17.97 ms | 418 KiB | 5 Q