Esempio n. 1
1
 public function testDHL()
 {
     $dhl = config('dhl');
     // Test a getQuote using DHL XML API
     $sample = new GetQuote();
     $sample->SiteID = "DHLMexico";
     $sample->Password = "******";
     // Set values of the request
     $sample->MessageTime = date("c");
     $sample->MessageReference = '1234567890123456789012345678901';
     $sample->BkgDetails->Date = date('Y-m-d');
     $piece = new PieceType();
     $piece->PieceID = 1;
     $piece->Height = 10;
     $piece->Depth = 5;
     $piece->Width = 10;
     $piece->Weight = 10;
     $sample->BkgDetails->addPiece($piece);
     $sample->BkgDetails->IsDutiable = 'N';
     $sample->BkgDetails->ReadyTime = 'PT10H21M';
     $sample->BkgDetails->ReadyTimeGMTOffset = '+01:00';
     $sample->BkgDetails->DimensionUnit = 'CM';
     $sample->BkgDetails->WeightUnit = 'KG';
     $sample->BkgDetails->PaymentCountryCode = 'MX';
     $sample->From->CountryCode = 'MX';
     $sample->From->Postalcode = '15700';
     $sample->From->City = 'DF';
     $sample->To->CountryCode = 'MX';
     $sample->To->Postalcode = '35078';
     $sample->To->City = 'DURANGO';
     // Call DHL XML API
     $start = microtime(true);
     echo $sample->toXML();
     $client = new WebserviceClient('staging');
     $xml = $client->call($sample);
     echo PHP_EOL . 'Executed in ' . (microtime(true) - $start) . ' seconds.' . PHP_EOL;
     echo $xml . PHP_EOL;
     $array_xml = json_decode(json_encode(simplexml_load_string($xml)), true);
     print_r($array_xml);
 }
Esempio n. 2
0
 */
/**
 * File:        GetQuote.php
 * Project:     DHL API
 *
 * @author      Al-Fallouji Bashar
 * @version     0.1
 */
use DHL\Entity\AM\GetQuote;
use DHL\Datatype\AM\PieceType;
use DHL\Client\Web as WebserviceClient;
require __DIR__ . '/../../init.php';
// DHL Settings
$dhl = $config['dhl'];
// Test a getQuote using DHL XML API
$sample = new GetQuote();
$sample->SiteID = $dhl['id'];
$sample->Password = $dhl['pass'];
// Set values of the request
$sample->MessageTime = '2001-12-17T09:30:47-05:00';
$sample->MessageReference = '1234567890123456789012345678901';
$sample->BkgDetails->Date = date('Y-m-d');
$piece = new PieceType();
$piece->PieceID = 1;
$piece->Height = 10;
$piece->Depth = 5;
$piece->Width = 10;
$piece->Weight = 10;
$sample->BkgDetails->addPiece($piece);
$sample->BkgDetails->IsDutiable = 'Y';
$sample->BkgDetails->QtdShp->QtdShpExChrg->SpecialServiceType = 'WY';