Created
September 18, 2020 18:24
-
-
Save dodeja/c537f722a9ca5eb3c45be30f3caaece4 to your computer and use it in GitHub Desktop.
PHP sample code to make a POST request to the Termianl49 Tracking Request API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$client = new http\Client; | |
$request = new http\Client\Request; | |
$body = new http\Message\Body; | |
$body->append('{"data":{"attributes":{"request_type":"bill_of_lading","request_number":"MEDUFR030802","scac":"MSCU"},"type":"tracking_request"}}'); | |
$request->setRequestUrl('https://api.terminal49.com/v2/tracking_requests'); | |
$request->setRequestMethod('POST'); | |
$request->setBody($body); | |
$request->setHeaders(array( | |
'authorization' => 'Token YOUR_API_TOKEN' | |
)); | |
$client->enqueue($request)->send(); | |
$response = $client->getResponse(); | |
echo $response->getBody(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment