Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $xml = '
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:epg="http://epg.generic.calculaterate/">
- <soapenv:Header>
- <epg:AuthHeader>
- <epg:AccountNo>E66846</epg:AccountNo>
- <epg:Password>E66846</epg:Password>
- </epg:AuthHeader>
- </soapenv:Header>
- <soapenv:Body>
- <epg:CalculateRateRequest>
- <epg:RateCalculationRequest>
- <epg:ShipmentType>Express</epg:ShipmentType>
- <epg:ServiceType>International</epg:ServiceType>
- <epg:ContentTypeCode>None</epg:ContentTypeCode>
- <epg:OriginState></epg:OriginState>
- <epg:OriginCity>1</epg:OriginCity>
- <epg:DestinationCountry>13</epg:DestinationCountry>
- <epg:DestinationState></epg:DestinationState>
- <epg:DestinationCity>156911</epg:DestinationCity>
- <epg:Height>10</epg:Height>
- <epg:Width>10</epg:Width>
- <epg:Length>10</epg:Length>
- <epg:DimensionUnit>Centimetre</epg:DimensionUnit>
- <epg:Weight>1000</epg:Weight>
- <epg:WeightUnit>Grams</epg:WeightUnit>
- <epg:CalculationCurrencyCode>AED</epg:CalculationCurrencyCode>
- <!--Optional:-->
- <epg:IsRegistered>Yes</epg:IsRegistered>
- <epg:ProductCode>EPG-22</epg:ProductCode>
- </epg:RateCalculationRequest>
- </epg:CalculateRateRequest>
- </soapenv:Body>
- </soapenv:Envelope>
- ';
- $headers = array(
- 'SOAPAction: http://epg.generic.calculaterate/CalculatePriceRate',
- "Content-type: text/xml;charset=\"utf-8\"",
- "Accept: text/xml",
- "Cache-Control: no-cache",
- "Pragma: no-cache",
- "Content-length: ".strlen($xml),
- );
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt($ch, CURLOPT_URL, 'https://osb.epg.gov.ae/ebs/genericapi/ratecalculator');
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_USERPWD, "E66846:E66846"); // username and password - declared at the top of the doc
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
- curl_setopt($ch, CURLOPT_TIMEOUT, 10);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); // the SOAP request
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- $response = curl_exec ($ch);
- curl_close ($ch);
- var_dump($response);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement