Endpoint:
POST https://acpapi.com/API/
POST data:
'apikey'=> 'a64ac717507ff768',
'command'=>'createMailing',
'testMode'=>1,
'labelFormat' => 'PDF',
'label' => 1,
'data' => <XML data>
<?xml version="1.0" encoding="UTF-8"?> <shippingApiRequest> <mailItem> <s1hipperItemId>xWUK4840GB27298018801x</s1hipperItemId> <displayItemId>qDC1704789588537</displayItemId> <consignee> <name>John Doe</name> <companyName /> <addressLine1>1285 Parklane Ave</addressLine1> <addressLine2 /> <city>Louisville</city> <state>KY</state> <zip>40204</zip> <country>US</country> <phone>9119119111</phone> <email>john.doe@dot.com</email> </consignee> <shipper> <name /> <companyName>Best shipper LLC</companyName> <addressLine1>Unit 1</addressLine1> <addressLine2>Blenheim Court, Brownfields</addressLine2> <city>Welwyn Garden City</city> <state /> <zip>AL7 1AD</zip> <country>GB</country> <phone>07429 850748</phone> <email>best_shipper_llc@null.com</email> <shipperURL>http://some.domain.com</shipperURL> </shipper> <value>52.16</value> <currency>GBP</currency> <weight>1.65</weight> <weightUnitOfMeasure>kg</weightUnitOfMeasure> <dimensions> <length>0.1</length> <width>0.1</width> <height>0.1</height> </dimensions> <dimensionsUnitOfMeasure>m</dimensionsUnitOfMeasure> <product> <countryOfOrigin>CN</countryOfOrigin> <harmonizationCode>6307909885</harmonizationCode> <description>Antique Glove Box</description> <sku>BOBL-PK1</sku> <quantity>2</quantity> <value>52.16</value> </product> </mailItem> </shippingApiRequest>
<?php $url = "https://acpapi.com/API/"; $headers = [ "content-type: application/x-www-form-urlencoded" ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0'); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(getPostData())); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300); if (($data = curl_exec($ch)) === false) { echo 'Curl error: ' . curl_error($ch) . PHP_EOL; exit(); } curl_close($ch); $data = simplexml_load_string($data); $json = json_encode($data); $array = json_decode($json, TRUE); print_r('REQUEST => '); print_r(getPostData()); print_r('===================================================================================' . PHP_EOL); print_r('RESPONSE => '); print_r($array); function getPostData(): array { return [ 'apikey' => 'a64ac717507ff768', 'command' => 'createMailing', 'testMode' => 1, 'data' => getXMLData(), 'labelFormat' => 'PDF', 'label' => 1 ]; } function getXMLData(): string { return '<?xml version="1.0" encoding="UTF-8"?> <shippingApiRequest> <mailItem> <s1hipperItemId>xWUK4840GB27298018801x</s1hipperItemId> <displayItemId>qDC1704789588537</displayItemId> <consignee> <name>John Doe</name> <companyName /> <addressLine1>1285 Parkland Ave</addressLine1> <addressLine2 /> <city>Louisville</city> <state>KY</state> <zip>40204</zip> <country>US</country> <phone>9119119111</phone> <email>john.doe@dot.com</email> </consignee> <shipper> <name /> <companyName>Best shipper LLC</companyName> <addressLine1>Unit 1</addressLine1> <addressLine2>Blenheim Court, Brownfield</addressLine2> <city>Selwyn Garden City</city> <state /> <zip>AL7 1AD</zip> <country>GB</country> <phone>07429 850748</phone> <email>best_shipper_llc@null.com</email> <shipperURL>https://some.domain.com</shipperURL> </shipper> <value>52.16</value> <currency>GBP</currency> <weight>1.65</weight> <weightUnitOfMeasure>kg</weightUnitOfMeasure> <dimensions> <length>0.1</length> <width>0.1</width> <height>0.1</height> </dimensions> <dimensionsUnitOfMeasure>m</dimensionsUnitOfMeasure> <product> <countryOfOrigin>CN</countryOfOrigin> <harmonizationCode>6307909885</harmonizationCode> <description>Antique Glove Box</description> <sku>BOBL-PK1</sku> <quantity>2</quantity> <value>52.16</value> </product> </mailItem> </shippingApiRequest>'; }
<?php namespace App\Console\Commands; use Illuminate\Console\Command; use Illuminate\Support\Facades\Http; class acpMailingLaravelCommand extends Command { protected $signature = 'acp:mailing'; protected $description = 'ACP Create Mailing'; public function handle() { $response = Http::asForm()->post('https://acpapi.com/API/', $this->getPostData()); dd($response->body()); } private function getPostData(): array { return [ 'apikey' => 'a64ac717507ff768', 'command' => 'createMailing', 'testMode' => 1, 'data' => $this->getXMLData(), 'labelFormat' => 'PDF', 'label' => 1, ]; } private function getXMLData(): string { return '<?xml version="1.0" encoding="UTF-8"?> <shippingApiRequest> <mailItem> <s1hipperItemId>xWUK4840GB27298018801x</s1hipperItemId> <displayItemId>qDC1704789588537</displayItemId> <consignee> <name>John Doe</name> <companyName /> <addressLine1>1285 Parkland Ave</addressLine1> <addressLine2 /> <city>Louisville</city> <state>KY</state> <zip>40204</zip> <country>US</country> <phone>9119119111</phone> <email>john.doe@dot.com</email> </consignee> <shipper> <name /> <companyName>Best shipper LLC</companyName> <addressLine1>Unit 1</addressLine1> <addressLine2>Blenheim Court, Brownfield</addressLine2> <city>Selwyn Garden City</city> <state /> <zip>AL7 1AD</zip> <country>GB</country> <phone>07429 850748</phone> <email>best_shipper_llc@null.com</email> <shipperURL>https://some.domain.com</shipperURL> </shipper> <value>52.16</value> <currency>GBP</currency> <weight>1.65</weight> <weightUnitOfMeasure>kg</weightUnitOfMeasure> <dimensions> <length>0.1</length> <width>0.1</width> <height>0.1</height> </dimensions> <dimensionsUnitOfMeasure>m</dimensionsUnitOfMeasure> <product> <countryOfOrigin>CN</countryOfOrigin> <harmonizationCode>6307909885</harmonizationCode> <description>Antique Glove Box</description> <sku>BOBL-PK1</sku> <quantity>2</quantity> <value>52.16</value> </product> </mailItem> </shippingApiRequest>'; } }
curl --location 'https://acpapi.com/API/' \ --header 'content-type: application/x-www-form-urlencoded' \ --data-urlencode 'apikey=a64ac717507ff768' \ --data-urlencode 'command=createMailing' \ --data-urlencode 'testMode=1' \ --data-urlencode 'labelFormat=PDF' \ --data-urlencode 'label=1' \ --data-urlencode 'data=<?xml version="1.0" encoding="UTF-8"?> <shippingApiRequest> <mailItem> <s1hipperItemId>xWUK4840GB27298018801x</s1hipperItemId> <displayItemId>qDC1704789588537</displayItemId> <consignee> <name>John Doe</name> <companyName /> <addressLine1>1285 Parkland Ave</addressLine1> <addressLine2 /> <city>Louisville</city> <state>KY</state> <zip>40204</zip> <country>US</country> <phone>9119119111</phone> <email>john.doe@dot.com</email> </consignee> <shipper> <name /> <companyName>Best shipper LLC</companyName> <addressLine1>Unit 1</addressLine1> <addressLine2>Blenheim Court, Brownfield</addressLine2> <city>Selwyn Garden City</city> <state /> <zip>AL7 1AD</zip> <country>GB</country> <phone>07429 850748</phone> <email>best_shipper_llc@null.com</email> <shipperURL>https://some.domain.com</shipperURL> </shipper> <value>52.16</value> <currency>GBP</currency> <weight>1.65</weight> <weightUnitOfMeasure>kg</weightUnitOfMeasure> <dimensions> <length>0.1</length> <width>0.1</width> <height>0.1</height> </dimensions> <dimensionsUnitOfMeasure>m</dimensionsUnitOfMeasure> <product> <countryOfOrigin>CN</countryOfOrigin> <harmonizationCode>6307909885</harmonizationCode> <description>Antique Glove Box</description> <sku>BOBL-PK1</sku> <quantity>2</quantity> <value>52.16</value> </product> </mailItem> </shippingApiRequest>'
Endpoint:
POST https://acpapi.com/API/
POST data:
'apikey'=> 'a64ac717507ff768',
'command'=>'createBag',
'testMode'=>1,
'airport' => 'LAX',
'labelFormat' => 'EPL2',
'label' => 1,
'data' => <XML data>
<?xml version="1.0" encoding="UTF-8"?> <shippingApiRequest> <bag> <mailItem> <trackingNumber>9261290315428314872667</trackingNumber> </mailItem> <mailItem> <trackingNumber>9261290315428314872650</trackingNumber> </mailItem> </bag> </shippingApiRequest>
<?php $url = "https://acpapi.com/API/"; $headers = [ "content-type: application/x-www-form-urlencoded" ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0'); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(getPostData())); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300); if (($data = curl_exec($ch)) === false) { echo 'Curl error: ' . curl_error($ch) . PHP_EOL; exit(); } curl_close($ch); $data = simplexml_load_string($data); $json = json_encode($data); $array = json_decode($json,TRUE); print_r('REQUEST => '); print_r(getPostData()); print_r('===================================================================================' . PHP_EOL); print_r('RESPONSE => '); print_r($array); function getPostData(): array { return [ 'apikey'=> 'a64ac717507ff768', 'command'=>'createBag', 'testMode'=>1, 'data' => getXMLData(), 'labelFormat' => 'EPL2', 'airport' => 'LAX', 'label' => 1 ]; } function getXMLData(): string { return '<?xml version="1.0" encoding="UTF-8"?> <shippingApiRequest> <bag> <mailItem> <trackingNumber>9261290315428314872667</trackingNumber> </mailItem> <mailItem> <trackingNumber>9261290315428314872650</trackingNumber> </mailItem> </bag> </shippingApiRequest>'; }
<?php namespace App\Console\Commands; use Illuminate\Console\Command; use Illuminate\Support\Facades\Http; class acpBagLaravelCommand extends Command { protected $signature = 'acp:bag'; protected $description = 'ACP Create Bag'; public function handle() { $response = Http::asForm()->post('https://acpapi.com/API/', $this->getPostData()); dd($response->body()); } private function getPostData(): array { return [ 'apikey'=> 'a64ac717507ff768', 'command'=>'createBag', 'testMode'=>1, 'data' => $this->getXMLData(), 'labelFormat' => 'EPL2', 'airport' => 'LAX', 'label' => 1, ]; } private function getXMLData(): string { return '<?xml version="1.0" encoding="UTF-8"?> <shippingApiRequest> <bag> <mailItem> <trackingNumber>9261290315428314872667</trackingNumber> </mailItem> <mailItem> <trackingNumber>9261290315428314872650</trackingNumber> </mailItem> </bag> </shippingApiRequest>'; } }
curl --location 'https://acpapi.com/API/' \ --header 'content-type: application/x-www-form-urlencoded' \ --data-urlencode 'apikey=a64ac717507ff768' \ --data-urlencode 'command=createBag' \ --data-urlencode 'testMode=1' \ --data-urlencode 'labelFormat=EPL2' \ --data-urlencode 'airport=LAX' \ --data-urlencode 'label=1' \ --data-urlencode 'data=<?xml version="1.0" encoding="UTF-8"?> <shippingApiRequest> <bag> <mailItem> <trackingNumber>9261290315428314872667</trackingNumber> </mailItem> <mailItem> <trackingNumber>9261290315428314872650</trackingNumber> </mailItem> </bag> </shippingApiRequest>'
Endpoint:
POST https://acpapi.com/API/
POST data:
'apikey'=> 'a64ac717507ff768',
'command'=>'createReturnMailing',
'testMode'=>1,
'labelFormat' => 'PNG',
'label' => 1,
'data' => <XML data>
<?xml version="1.0" encoding="UTF-8"?> <shippingApiRequest> <mailItem> <shipperItemId>624555</shipperItemId> <displayItemId>624555</displayItemId> <returnAddress> <name>Test Company</name> <companyName>Test Company</companyName> <addressLine1>Test1</addressLine1> <addressLine2>Test2</addressLine2> <city>Washington</city> <state>Washington, D.C.</state> <zip>20013</zip> <country>US</country> <phone>1234567</phone> <email>test@example.com</email> </returnAddress> <consignee> <name>John doe</name> <companyName>totowa</companyName> <addressLine1>4 Taft Road</addressLine1> <addressLine2 /> <city>Totowa</city> <state>NJ</state> <zip>07512</zip> <country>US</country> <phone>131312321123</phone> <email>test@test.test</email> </consignee> <value>20.00</value> <currency>USD</currency> <weight>1.000</weight> <weightUnitOfMeasure>kg</weightUnitOfMeasure> <dimensions> <length>0.05</length> <width>0.05</width> <height>0.05</height> </dimensions> <dimensionsUnitOfMeasure>m</dimensionsUnitOfMeasure> <product> <countryOfOrigin>BZ</countryOfOrigin> <harmonizationCode>6307909885</harmonizationCode> <description>Antique Glove Box</description> <manufacturerCode /> <sku>BOBL-PK1</sku> <quantity>1</quantity> <unitValue>20.00</unitValue> <value>20.00</value> <weight>1.000</weight> <productURL /> </product> </mailItem> </shippingApiRequest>
<?php $url = "https://acpapi.com/API/"; $headers = [ "content-type: application/x-www-form-urlencoded" ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0'); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(getPostData())); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300); if (($data = curl_exec($ch)) === false) { echo 'Curl error: ' . curl_error($ch); } curl_close($ch); $data = simplexml_load_string($data); $json = json_encode($data); $array = json_decode($json,TRUE); print_r('REQUEST => '); print_r(getPostData()); print_r('===================================================================================' . PHP_EOL); print_r('RESPONSE => '); print_r($array); function getPostData(): array { return [ 'apikey'=> 'a64ac717507ff768', 'command'=>'createReturnMailing', 'testMode'=> 1, 'labelFormat' => 'PNG', 'data' => getXMLData(), 'label'=>'1' ]; } function getXMLData(): string { return '<?xml version="1.0" encoding="UTF-8"?> <shippingApiRequest> <mailItem> <shipperItemId>624555</shipperItemId> <displayItemId>624555</displayItemId> <returnAddress> <name>Test Company</name> <companyName>Test Company</companyName> <addressLine1>Test1</addressLine1> <addressLine2>Test2</addressLine2> <city>Washington</city> <state>Washington, D.C.</state> <zip>20013</zip> <country>US</country> <phone>1234567</phone> <email>test@example.com</email> </returnAddress> <consignee> <name>John doe</name> <companyName>totowa</companyName> <addressLine1>4 Taft Road</addressLine1> <addressLine2 /> <city>Totowa</city> <state>NJ</state> <zip>07512</zip> <country>US</country> <phone>131312321123</phone> <email>test@test.test</email> </consignee> <value>20.00</value> <currency>USD</currency> <weight>1.000</weight> <weightUnitOfMeasure>kg</weightUnitOfMeasure> <dimensions> <length>0.05</length> <width>0.05</width> <height>0.05</height> </dimensions> <dimensionsUnitOfMeasure>m</dimensionsUnitOfMeasure> <product> <countryOfOrigin>BZ</countryOfOrigin> <harmonizationCode>6307909885</harmonizationCode> <description>Antique Glove Box</description> <manufacturerCode /> <sku>BOBL-PK1</sku> <quantity>1</quantity> <unitValue>20.00</unitValue> <value>20.00</value> <weight>1.000</weight> <productURL /> </product> </mailItem> </shippingApiRequest>'; }
<?php namespace App\Console\Commands; use Illuminate\Console\Command; use Illuminate\Support\Facades\Http; class acpReturnLaravelCommand extends Command { protected $signature = 'acp:return'; protected $description = 'ACP Create Return mailing'; public function handle() { $response = Http::asForm()->post('https://acpapi.com/API/', $this->getPostData()); dd($response->body()); } private function getPostData(): array { return [ 'apikey'=> 'a64ac717507ff768', 'command'=>'createReturnMailing', 'testMode'=> 1, 'labelFormat' => 'PNG', 'data' => $this->getXMLData(), 'label'=>'1' ]; } private function getXMLData(): string { return '<?xml version="1.0" encoding="UTF-8"?> <shippingApiRequest> <mailItem> <shipperItemId>624555</shipperItemId> <displayItemId>624555</displayItemId> <returnAddress> <name>Test Company</name> <companyName>Test Company</companyName> <addressLine1>Test1</addressLine1> <addressLine2>Test2</addressLine2> <city>Washington</city> <state>Washington, D.C.</state> <zip>20013</zip> <country>US</country> <phone>1234567</phone> <email>test@example.com</email> </returnAddress> <consignee> <name>John doe</name> <companyName>totowa</companyName> <addressLine1>4 Taft Road</addressLine1> <addressLine2 /> <city>Totowa</city> <state>NJ</state> <zip>07512</zip> <country>US</country> <phone>131312321123</phone> <email>test@test.test</email> </consignee> <value>20.00</value> <currency>USD</currency> <weight>1.000</weight> <weightUnitOfMeasure>kg</weightUnitOfMeasure> <dimensions> <length>0.05</length> <width>0.05</width> <height>0.05</height> </dimensions> <dimensionsUnitOfMeasure>m</dimensionsUnitOfMeasure> <product> <countryOfOrigin>BZ</countryOfOrigin> <harmonizationCode>6307909885</harmonizationCode> <description>Antique Glove Box</description> <manufacturerCode /> <sku>BOBL-PK1</sku> <quantity>1</quantity> <unitValue>20.00</unitValue> <value>20.00</value> <weight>1.000</weight> <productURL /> </product> </mailItem> </shippingApiRequest>'; } }
curl --location 'https://acpapi.com/API/' \ --header 'content-type: application/x-www-form-urlencoded' \ --data-urlencode 'apikey=a64ac717507ff768' \ --data-urlencode 'command=createReturnMailing' \ --data-urlencode 'testMode=1' \ --data-urlencode 'labelFormat=PNG' \ --data-urlencode 'label=1' \ --data-urlencode 'data=<?xml version="1.0" encoding="UTF-8"?> <shippingApiRequest> <mailItem> <shipperItemId>624555</shipperItemId> <displayItemId>624555</displayItemId> <returnAddress> <name>Test Company</name> <companyName>Test Company</companyName> <addressLine1>Test1</addressLine1> <addressLine2>Test2</addressLine2> <city>Washington</city> <state>Washington, D.C.</state> <zip>20013</zip> <country>US</country> <phone>1234567</phone> <email>test@example.com</email> </returnAddress> <consignee> <name>John doe</name> <companyName>totowa</companyName> <addressLine1>4 Taft Road</addressLine1> <addressLine2 /> <city>Totowa</city> <state>NJ</state> <zip>07512</zip> <country>US</country> <phone>131312321123</phone> <email>test@test.test</email> </consignee> <value>20.00</value> <currency>USD</currency> <weight>1.000</weight> <weightUnitOfMeasure>kg</weightUnitOfMeasure> <dimensions> <length>0.05</length> <width>0.05</width> <height>0.05</height> </dimensions> <dimensionsUnitOfMeasure>m</dimensionsUnitOfMeasure> <product> <countryOfOrigin>BZ</countryOfOrigin> <harmonizationCode>6307909885</harmonizationCode> <description>Antique Glove Box</description> <manufacturerCode /> <sku>BOBL-PK1</sku> <quantity>1</quantity> <unitValue>20.00</unitValue> <value>20.00</value> <weight>1.000</weight> <productURL /> </product> </mailItem> </shippingApiRequest>'
Endpoint:
POST https://acpapi.com/API/
POST data:
'apikey'=> 'a64ac717507ff768',
'command'=>'createManifest',
'testMode'=>1,
'data' => <XML data>
<shippingApiRequest> <manifest> <manifestNumber>112-58627443</manifestNumber> <senderWarehouseId>436950</senderWarehouseId> <receiverWarehouseId>436979</receiverWarehouseId> <shippingUnits>1</shippingUnits> <userDefinedWeight>1</userDefinedWeight> <userDefinedWeightUOM>KG</userDefinedWeightUOM> <manifestPart> <departureFacility>LHR</departureFacility> <departureDate>2020-04-08T16:47:00Z</departureDate> <arrivalFacility>JFK</arrivalFacility> <arrivalDate>2020-04-19T15:47:00Z</arrivalDate> <carrier>VS</carrier> <tripNumber>003</tripNumber> <unit> <unitId>9261290315428314872667</unitId> </unit> <unit> <unitId>9261290315428314872650</unitId> </unit> </manifestPart> <comment>test</comment> </manifest> </shippingApiRequest>
<?php $url = "https://acpapi.com/API/"; $headers = [ "content-type: application/x-www-form-urlencoded" ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0'); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(getPostData())); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300); if (($data = curl_exec($ch)) === false) { echo 'Curl error: ' . curl_error($ch); } curl_close($ch); $data = simplexml_load_string($data); $json = json_encode($data); $array = json_decode($json,TRUE); print_r('REQUEST => '); print_r(getPostData()); print_r('===================================================================================' . PHP_EOL); print_r('RESPONSE => '); print_r($array); function getPostData(): array { return [ 'apikey'=> 'a64ac717507ff768', 'command'=>'createManifest', 'testMode'=>'1', 'data' => getXMLData(), ]; } function getXMLData(): string { return '<?xml version="1.0" encoding="UTF-8"?> <shippingApiRequest> <manifest> <manifestNumber>112-58627443</manifestNumber> <senderWarehouseId>436950</senderWarehouseId> <receiverWarehouseId>436979</receiverWarehouseId> <shippingUnits>1</shippingUnits> <userDefinedWeight>1</userDefinedWeight> <userDefinedWeightUOM>KG</userDefinedWeightUOM> <manifestPart> <departureFacility>LHR</departureFacility> <departureDate>2020-04-08T16:47:00Z</departureDate> <arrivalFacility>JFK</arrivalFacility> <arrivalDate>2020-04-19T15:47:00Z</arrivalDate> <carrier>VS</carrier> <tripNumber>003</tripNumber> <unit> <unitId>9261290315428314872667</unitId> </unit> <unit> <unitId>9261290315428314872650</unitId> </unit> </manifestPart> <comment>test</comment> </manifest> </shippingApiRequest>'; }
<?php namespace App\Console\Commands; use Illuminate\Console\Command; use Illuminate\Support\Facades\Http; class acpManifestLaravelCommand extends Command { protected $signature = 'acp:manifest'; protected $description = 'ACP Create Manifest'; public function handle() { $response = Http::asForm()->post('https://acpapi.com/API/', $this->getPostData()); dd($response->body()); } private function getPostData(): array { return [ 'apikey'=> 'a64ac717507ff768', 'command'=>'createManifest', 'testMode'=>'1', 'data' => $this->getXMLData(), ]; } private function getXMLData(): string { return '<?xml version="1.0" encoding="UTF-8"?> <shippingApiRequest> <manifest> <manifestNumber>112-58627443</manifestNumber> <senderWarehouseId>436950</senderWarehouseId> <receiverWarehouseId>436979</receiverWarehouseId> <shippingUnits>1</shippingUnits> <userDefinedWeight>1</userDefinedWeight> <userDefinedWeightUOM>KG</userDefinedWeightUOM> <manifestPart> <departureFacility>LHR</departureFacility> <departureDate>2020-04-08T16:47:00Z</departureDate> <arrivalFacility>JFK</arrivalFacility> <arrivalDate>2020-04-19T15:47:00Z</arrivalDate> <carrier>VS</carrier> <tripNumber>003</tripNumber> <unit> <unitId>9261290315428314872667</unitId> </unit> <unit> <unitId>9261290315428314872650</unitId> </unit> </manifestPart> <comment>test</comment> </manifest> </shippingApiRequest>'; } }
curl --location 'https://acpapi.com/API/' \ --header 'content-type: application/x-www-form-urlencoded' \ --data-urlencode 'apikey=a64ac717507ff768' \ --data-urlencode 'command=createManifest' \ --data-urlencode 'testMode=1' \ --data-urlencode 'data=<?xml version="1.0" encoding="UTF-8"?> <shippingApiRequest> <manifest> <manifestNumber>112-58627443</manifestNumber> <senderWarehouseId>436950</senderWarehouseId> <receiverWarehouseId>436979</receiverWarehouseId> <shippingUnits>1</shippingUnits> <userDefinedWeight>1</userDefinedWeight> <userDefinedWeightUOM>KG</userDefinedWeightUOM> <manifestPart> <departureFacility>LHR</departureFacility> <departureDate>2020-04-08T16:47:00Z</departureDate> <arrivalFacility>JFK</arrivalFacility> <arrivalDate>2020-04-19T15:47:00Z</arrivalDate> <carrier>VS</carrier> <tripNumber>003</tripNumber> <unit> <unitId>9261290315428314872667</unitId> </unit> <unit> <unitId>9261290315428314872650</unitId> </unit> </manifestPart> <comment>test</comment> </manifest> </shippingApiRequest>'
Endpoint:
POST https://acpapi.com/API/
POST data:
'apikey'=> 'a64ac717507ff768',
'command'=>'createManifest',
'testMode'=>1,
'data' => <XML data>
<?xml version="1.0" encoding="UTF-8"?> <shippingApiRequest> <mailItem> <trackingNumber>9631091350664177595100273900224351</trackingNumber> </mailItem> </shippingApiRequest>
<?php $url = "https://acpapi.com/API/"; $headers = [ "content-type: application/x-www-form-urlencoded" ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0'); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(getPostData())); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300); if (($data = curl_exec($ch)) === false) { echo 'Curl error: ' . curl_error($ch) . PHP_EOL; exit(); } curl_close($ch); $data = simplexml_load_string($data); $json = json_encode($data); $array = json_decode($json,TRUE); print_r('REQUEST => '); print_r(getPostData()); print_r('===================================================================================' . PHP_EOL); print_r('RESPONSE => '); print_r($array); function getPostData(): array { return [ 'apikey'=> 'a64ac717507ff768', 'command'=>'trackMailing', 'testMode'=>1, 'data' => getXMLData(), ]; } function getXMLData(): string { return '<?xml version="1.0" encoding="UTF-8"?> <shippingApiRequest> <mailItem> <trackingNumber>9631091350664177595100273900224351</trackingNumber> </mailItem> </shippingApiRequest>'; }
<?php namespace App\Console\Commands; use Illuminate\Console\Command; use Illuminate\Support\Facades\Http; class acpTrackMailingLaravelCommand extends Command { protected $signature = 'acp:track_mailing'; protected $description = 'ACP Track Mailing'; public function handle() { $response = Http::asForm()->post('https://acpapi.com/API/', $this->getPostData()); dd($response->body()); } private function getPostData(): array { return [ 'apikey'=> 'a64ac717507ff768', 'command'=>'trackMailing', 'testMode'=>1, 'data' => $this->getXMLData(), ]; } private function getXMLData(): string { return '<?xml version="1.0" encoding="UTF-8"?> <shippingApiRequest> <mailItem> <trackingNumber>9631091350664177595100273900224351</trackingNumber> </mailItem> </shippingApiRequest>'; } }
curl --location 'https://acpapi.com/API/' \ --header 'content-type: application/x-www-form-urlencoded' \ --data-urlencode 'apikey=a64ac717507ff768' \ --data-urlencode 'command=trackMailing' \ --data-urlencode 'testMode=1' \ --data-urlencode 'data=<?xml version="1.0" encoding="UTF-8"?> <shippingApiRequest> <mailItem> <trackingNumber>9631091350664177595100273900224351</trackingNumber> </mailItem> </shippingApiRequest>'