Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.12 KB | None | 0 0
  1. <?php
  2. $xml = '
  3. <soapenv:Envelope   xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:epg="http://epg.generic.calculaterate/">
  4. <soapenv:Header>
  5. <epg:AuthHeader>
  6. <epg:AccountNo>E66846</epg:AccountNo>
  7. <epg:Password>E66846</epg:Password>
  8. </epg:AuthHeader>
  9. </soapenv:Header>
  10. <soapenv:Body>
  11. <epg:CalculateRateRequest>
  12. <epg:RateCalculationRequest>
  13. <epg:ShipmentType>Express</epg:ShipmentType>
  14. <epg:ServiceType>International</epg:ServiceType>
  15. <epg:ContentTypeCode>None</epg:ContentTypeCode>
  16. <epg:OriginState></epg:OriginState>
  17. <epg:OriginCity>1</epg:OriginCity>
  18. <epg:DestinationCountry>13</epg:DestinationCountry>
  19. <epg:DestinationState></epg:DestinationState>
  20. <epg:DestinationCity>156911</epg:DestinationCity>
  21. <epg:Height>10</epg:Height>
  22. <epg:Width>10</epg:Width>
  23. <epg:Length>10</epg:Length>
  24. <epg:DimensionUnit>Centimetre</epg:DimensionUnit>
  25. <epg:Weight>1000</epg:Weight>
  26. <epg:WeightUnit>Grams</epg:WeightUnit>
  27. <epg:CalculationCurrencyCode>AED</epg:CalculationCurrencyCode>
  28. <!--Optional:-->
  29. <epg:IsRegistered>Yes</epg:IsRegistered>
  30. <epg:ProductCode>EPG-22</epg:ProductCode>
  31. </epg:RateCalculationRequest>
  32. </epg:CalculateRateRequest>
  33. </soapenv:Body>
  34. </soapenv:Envelope>
  35. ';
  36.  
  37.     $headers =  array(
  38.         'SOAPAction: http://epg.generic.calculaterate/CalculatePriceRate',
  39.         "Content-type: text/xml;charset=\"utf-8\"",
  40.         "Accept: text/xml",
  41.         "Cache-Control: no-cache",
  42.         "Pragma: no-cache",
  43.         "Content-length: ".strlen($xml),
  44.     );
  45.  
  46.     $ch = curl_init();
  47.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  48.     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  49.     curl_setopt($ch, CURLOPT_URL, 'https://osb.epg.gov.ae/ebs/genericapi/ratecalculator');
  50.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  51.     curl_setopt($ch, CURLOPT_USERPWD, "E66846:E66846"); // username and password - declared at the top of the doc
  52.     curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
  53.     curl_setopt($ch, CURLOPT_TIMEOUT, 10);
  54.     curl_setopt($ch, CURLOPT_POST, true);
  55.     curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); // the SOAP request
  56.     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  57.     $response = curl_exec ($ch);
  58.     curl_close ($ch);
  59.  
  60.  
  61.     var_dump($response);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement