Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $xml = <<<EOT
- <?xml version="1.0" encoding="utf-8"?>
- <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
- <soap:Body>
- <InformacijaOPosiljci xmlns="http://TrackTrace.com">
- <strPrijemniBroj>CH176197243US</strPrijemniBroj>
- </InformacijaOPosiljci>
- </soap:Body>
- </soap:Envelope>
- EOT;
- $headers = [
- "Content-Type: text/xml; charset=utf-8",
- "Cache-Control: no-cache",
- "Pragma: no-cache",
- "Content-Length: ".strlen($xml)
- ];
- $curlh = curl_init();
- curl_setopt($curlh, CURLOPT_URL, 'https://e-racuni.postacg.me/TTService/Service1.asmx');
- curl_setopt($curlh, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curlh, CURLOPT_TIMEOUT, 10);
- curl_setopt($curlh, CURLOPT_POST, true);
- curl_setopt($curlh, CURLOPT_POSTFIELDS, $xml);
- curl_setopt($curlh, CURLOPT_HTTPHEADER, $headers);
- $resp = curl_exec($curlh);
- curl_close($curlh);
- $xml = new SimpleXMLElement($resp);
- $xml->registerXPathNamespace('d', 'urn:schemas-microsoft-com:xml-diffgram-v1');
- $tables = $xml->xpath('//TableName');
- foreach ($tables as $table) {
- echo $table->Opis . PHP_EOL;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement