Skip to content

Instantly share code, notes, and snippets.

@dodeja
Created September 18, 2020 18:24
Show Gist options
  • Save dodeja/c537f722a9ca5eb3c45be30f3caaece4 to your computer and use it in GitHub Desktop.
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
<?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