PHP ActiveX
PHP ActiveX
WIN Air Freight - Send New Pouch Request
See more HTTP Misc Examples
Sends a "POST /api/v1/Awb" to send a new pouch request.Chilkat PHP ActiveX Downloads
<?php
$success = 0;
// This example assumes the Chilkat HTTP API to have been previously unlocked.
// See Global Unlock Sample for sample code.
$http = new COM("Chilkat.Http");
// Set the "Accept" header to tell the web server that we'll accept an XML response.
$http->Accept = 'application/xml';
// Tell Chilkat to cache any received cookies to files in a particular directory
$http->CookieDir = 'c:/qa_data/cookies';
$http->SaveCookies = 1;
// Also tell Chilkat to load and send matching cookies from the CookieDir.
// The authToken cookie is first obtained in the login request. Each subsequent
// request sends the authToken cookie and saves the new authToken cookie to the CookieDir.
$http->SendCookies = 1;
// Build out XML pouch request...
$xml = new COM("Chilkat.Xml");
$xml->Tag = 'PouchDTO';
$xml->UpdateChildContent('Mawb|AwbID','');
$xml->UpdateChildContent('Mawb|AwbNumber','001-12312123');
$xml->UpdateChildContent('Mawb|AwbStatus','D');
$xml->UpdateChildContent('Mawb|eAWB','false');
$xml->UpdateChildContent('Mawb|WithPaper','false');
$xml->UpdateChildContent('Mawb|Parties|Shipper|WinID','444444');
$xml->UpdateChildContent('Mawb|Parties|Shipper|AccountNumber','12345');
$xml->UpdateChildContent('Mawb|Parties|Shipper|Name','AABC SHIPPING & PACKAGING, INC.');
$xml->UpdateChildContent('Mawb|Parties|Shipper|Phone','111-222-3334');
$xml->UpdateChildContent('Mawb|Parties|Shipper|Fax','222-111-3334');
$xml->UpdateChildContent('Mawb|Parties|Shipper|Email','');
$xml->UpdateChildContent('Mawb|Parties|Shipper|Address|Line1','500 HARBOR DRIVE');
$xml->UpdateChildContent('Mawb|Parties|Shipper|Address|Line2','SUITE B1211');
$xml->UpdateChildContent('Mawb|Parties|Shipper|Address|Place','BEAUFORT');
$xml->UpdateChildContent('Mawb|Parties|Shipper|Address|PostalCode','28516');
$xml->UpdateChildContent('Mawb|Parties|Shipper|Address|StateProvince','NC');
$xml->UpdateChildContent('Mawb|Parties|Shipper|Address|Country|Code','US');
$xml->UpdateChildContent('Mawb|Parties|Shipper|Address|Country|Name','U.S.A.');
$xml->UpdateChildContent('Mawb|Parties|Consignee|WinID','0');
$xml->UpdateChildContent('Mawb|Parties|Consignee|AccountNumber','');
$xml->UpdateChildContent('Mawb|Parties|Consignee|Name','DELTA MANUFACTURING');
$xml->UpdateChildContent('Mawb|Parties|Consignee|Phone','444-555-3333');
$xml->UpdateChildContent('Mawb|Parties|Consignee|Fax','');
$xml->UpdateChildContent('Mawb|Parties|Consignee|Email','');
$xml->UpdateChildContent('Mawb|Parties|Consignee|Address|Line1','185 RUE LAMANDE');
$xml->UpdateChildContent('Mawb|Parties|Consignee|Address|Line2','');
$xml->UpdateChildContent('Mawb|Parties|Consignee|Address|Place','PARIS');
$xml->UpdateChildContent('Mawb|Parties|Consignee|Address|PostalCode','75017');
$xml->UpdateChildContent('Mawb|Parties|Consignee|Address|StateProvince','');
$xml->UpdateChildContent('Mawb|Parties|Consignee|Address|Country|Code','FR');
$xml->UpdateChildContent('Mawb|Parties|Consignee|Address|Country|Name','FRANCE');
$xml->UpdateChildContent('Mawb|Parties|Notify|WinID','');
$xml->UpdateChildContent('Mawb|Parties|Notify|AccountNumber','');
$xml->UpdateChildContent('Mawb|Parties|Notify|Name','AABC SHIPPING, INC.');
$xml->UpdateChildContent('Mawb|Parties|Notify|Phone','');
$xml->UpdateChildContent('Mawb|Parties|Notify|Fax','');
$xml->UpdateChildContent('Mawb|Parties|Notify|Email','');
$xml->UpdateChildContent('Mawb|Parties|Notify|Address|Line1','110 FARA WAY');
$xml->UpdateChildContent('Mawb|Parties|Notify|Address|Line2','');
$xml->UpdateChildContent('Mawb|Parties|Notify|Address|Place','OZ');
$xml->UpdateChildContent('Mawb|Parties|Notify|Address|PostalCode','11222');
$xml->UpdateChildContent('Mawb|Parties|Notify|Address|StateProvince','NY');
$xml->UpdateChildContent('Mawb|Parties|Notify|Address|Country|Code','US');
$xml->UpdateChildContent('Mawb|Parties|Notify|Address|Country|Name','U.S.A.');
$xml->UpdateChildContent('Mawb|Parties|Agent|WinID','');
$xml->UpdateChildContent('Mawb|Parties|Agent|AccountNumber','FACCT#1234');
$xml->UpdateChildContent('Mawb|Accounting|Identifier','GEN');
$xml->UpdateChildContent('Mawb|Accounting|Information','SARFWER');
$xml->UpdateChildContent('Mawb|Accounting|Identifier','MCO');
$xml->UpdateChildContent('Mawb|Accounting|Information','WERWERWER');
$xml->UpdateChildContent('Mawb|ShipmentReference|ReferenceNumber','ZDFASF');
$xml->UpdateChildContent('Mawb|ShipmentReference|AdditionalInformation','ZDFASF');
$xml->UpdateChildContent('Mawb|RoutingDetails|FromAirportCode','EWN');
$xml->UpdateChildContent('Mawb|RoutingDetails|ToAirportCode','LON');
$xml->UpdateChildContent('Mawb|RoutingDetails|CarrierCode','AA');
$xml->UpdateChildContent('Mawb|RoutingDetails|FlightNumber','N123');
$xml->UpdateChildContent('Mawb|RoutingDetails|FlightDate','2016-11-30T00:00:00');
$xml->UpdateChildContent('Mawb|ChargesDeclaration|CurrencyCode','USD');
$xml->UpdateChildContent('Mawb|ChargesDeclaration|ChargeCode','PP');
$xml->UpdateChildContent('Mawb|ChargesDeclaration|WeightOrValuation','P');
$xml->UpdateChildContent('Mawb|ChargesDeclaration|Other','P');
$xml->UpdateChildContent('Mawb|ChargesDeclaration|ValuesForCarriage','1300.00');
$xml->UpdateChildContent('Mawb|ChargesDeclaration|ValuesForCustoms','12000.00');
$xml->UpdateChildContent('Mawb|ChargesDeclaration|ValuesForInsurance','11000.00');
$xml->UpdateChildContent('Mawb|Handling|SpecialServiceInformation','Please Notify Consigneetestwwwww');
$xml->UpdateChildContent('Mawb|Handling|OtherServiceInformation','');
$xml->UpdateChildContent('Mawb|Handling|SCI','');
$xml->UpdateChildContent('Mawb|Handling|SpecialHandling|Code','AOG');
$xml->UpdateChildContent('Mawb|Handling|SpecialHandling|Code','ATT');
$xml->UpdateChildContent('Mawb|Rates|NumberOfPieces','12');
$xml->UpdateChildContent('Mawb|Rates|GrossWeight|Value','244.70');
$xml->UpdateChildContent('Mawb|Rates|GrossWeight|UOM','L');
$xml->UpdateChildContent('Mawb|Rates|SLAC','12');
$xml->UpdateChildContent('Mawb|Rates|RateClassCode','N');
$xml->UpdateChildContent('Mawb|Rates|CommodityItemNumber','');
$xml->UpdateChildContent('Mawb|Rates|ChargeableWeight','245.0');
$xml->UpdateChildContent('Mawb|Rates|RateOrCharge','8.00');
$xml->UpdateChildContent('Mawb|Rates|ChargeAmount','1960.00');
$xml->UpdateChildContent('Mawb|Rates|NatureAndQuantityOfGoods','CONSOLIDATION PER ATTACHED MANIFEST.');
$xml->UpdateChildContent('Mawb|Rates|Dims|Pcs','12');
$xml->UpdateChildContent('Mawb|Rates|Dims|Length','4');
$xml->UpdateChildContent('Mawb|Rates|Dims|Width','8');
$xml->UpdateChildContent('Mawb|Rates|Dims|Height','4');
$xml->UpdateChildContent('Mawb|Rates|Dims|UOM','CMT');
$xml->UpdateChildContent('Mawb|ChargesSummary|WeightCharge','1960.00');
$xml->UpdateChildContent('Mawb|OtherCharges|Description','AW');
$xml->UpdateChildContent('Mawb|OtherCharges|Amount','123.00');
$xml->UpdateChildContent('Mawb|OtherCharges|ChargeIdentifier','C');
$xml->UpdateChildContent('Mawb|OtherCharges|PrepaidCollect','C');
$xml->UpdateChildContent('Mawb|OtherCharges|Description','FC');
$xml->UpdateChildContent('Mawb|OtherCharges|Amount','55.00');
$xml->UpdateChildContent('Mawb|OtherCharges|ChargeIdentifier','A');
$xml->UpdateChildContent('Mawb|OtherCharges|PrepaidCollect','P');
$xml->UpdateChildContent('Mawb|OtherCharges|Description','FC');
$xml->UpdateChildContent('Mawb|OtherCharges|Amount','101.00');
$xml->UpdateChildContent('Mawb|OtherCharges|ChargeIdentifier','C');
$xml->UpdateChildContent('Mawb|OtherCharges|PrepaidCollect','C');
$xml->UpdateChildContent('Mawb|EmailNotifications|Name','');
$xml->UpdateChildContent('Mawb|EmailNotifications|Email','');
$xml->UpdateChildContent('Mawb|EmailNotifications|Name','');
$xml->UpdateChildContent('Mawb|EmailNotifications|Email','');
$xml->UpdateChildContent('Mawb|EmailNotifications|Name','');
$xml->UpdateChildContent('Mawb|EmailNotifications|Email','');
$xml->UpdateChildContent('Mawb|EmailNotifications|Name','');
$xml->UpdateChildContent('Mawb|EmailNotifications|Email','');
$xml->UpdateChildContent('Mawb|Execution|Date','2015-08-07T00:00:00');
$xml->UpdateChildContent('Mawb|Execution|Place','OZ NY');
$xml->UpdateChildContent('Mawb|Execution|ShipperSignature','OAS FREIGHT FORWARDE');
$xml->UpdateChildContent('Mawb|Execution|CarrierSignature','OAS FREIGHT FORWARDE');
$xml->UpdateChildContent('Hawbs|AwbNumber','001-12312123');
$xml->UpdateChildContent('Hawbs|HawbNumber','CGL201107-27');
$xml->UpdateChildContent('Hawbs|HawbStatus','D');
$xml->UpdateChildContent('Hawbs|NumberOfPieces','12');
$xml->UpdateChildContent('Hawbs|GrossWeight|Value','244.70');
$xml->UpdateChildContent('Hawbs|GrossWeight|UOM','K');
$xml->UpdateChildContent('Hawbs|Locations|PortOfOrigin|Code','EWN');
$xml->UpdateChildContent('Hawbs|Locations|PortOfDestination|Code','LON');
$xml->UpdateChildContent('Hawbs|Commodity','HWB #: CGL20110');
$xml->UpdateChildContent('Hawbs|SLAC','12');
$xml->UpdateChildContent('Hawbs|Parties|Shipper|Name','ABC SHIPPNG AGAIN');
$xml->UpdateChildContent('Hawbs|Parties|Shipper|Phone','111-222-3333');
$xml->UpdateChildContent('Hawbs|Parties|Shipper|Fax','');
$xml->UpdateChildContent('Hawbs|Parties|Shipper|Email','');
$xml->UpdateChildContent('Hawbs|Parties|Shipper|Address|Line1','100 MAIN STREET');
$xml->UpdateChildContent('Hawbs|Parties|Shipper|Address|Place','OZ');
$xml->UpdateChildContent('Hawbs|Parties|Shipper|Address|PostalCode','ZIP');
$xml->UpdateChildContent('Hawbs|Parties|Shipper|Address|StateProvince','NY');
$xml->UpdateChildContent('Hawbs|Parties|Shipper|Address|Country|Code','US');
$xml->UpdateChildContent('Hawbs|Parties|Consignee|Name','AABC SHIPPING & PACKAGING, INC.');
$xml->UpdateChildContent('Hawbs|Parties|Consignee|Phone','111-222-3334');
$xml->UpdateChildContent('Hawbs|Parties|Consignee|Fax','222-111-3334');
$xml->UpdateChildContent('Hawbs|Parties|Consignee|Email','');
$xml->UpdateChildContent('Hawbs|Parties|Consignee|Address|Line1','500 HARBOR DRIVE');
$xml->UpdateChildContent('Hawbs|Parties|Consignee|Address|Place','BEAUFORT');
$xml->UpdateChildContent('Hawbs|Parties|Consignee|Address|PostalCode','28516');
$xml->UpdateChildContent('Hawbs|Parties|Consignee|Address|StateProvince','NC');
$xml->UpdateChildContent('Hawbs|Parties|Consignee|Address|Country|Code','US');
$xml->EmitXmlDecl = 0;
$httpRequestBody = $xml->getXml();
$resp = new COM("Chilkat.HttpResponse");
$success = $http->HttpStr('POST','http://integration.winwebconnect.com/api/v1/Awb',$httpRequestBody,'utf-8','application/xml',$resp);
if ($success == 0) {
print $http->LastErrorText . "\n";
exit;
}
$xmlResponse = new COM("Chilkat.Xml");
$xmlResponse->LoadXml($resp->BodyStr);
// See below for an example XML response body.
print 'Response Body:' . "\n";
print $xmlResponse->getXml() . "\n";
print '---' . "\n";
print 'Response Header:' . "\n";
print $resp->Header . "\n";
print 'Success.' . "\n";
?>