Skip to content

Instantly share code, notes, and snippets.

@acolin
Created August 11, 2016 19:58
Show Gist options
  • Save acolin/cbea00146eeb19c17991832eb86b1350 to your computer and use it in GitHub Desktop.
Save acolin/cbea00146eeb19c17991832eb86b1350 to your computer and use it in GitHub Desktop.
<?php
$request = new HttpRequest();
$request->setUrl('http://54.191.139.107/api/v2/shipping_rates');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'postman-token' => '1bbbe833-ee3b-4075-a024-ebe4f8bae2de',
'cache-control' => 'no-cache',
'content-type' => 'application/json'
));
$request->setBody('{
"rate": {
"origin": {
"country": "MX",
"postal_code": "64898",
"province": "NL",
"city": "Monterrey",
"name": null,
"address1": "hda. cataluña 4941",
"address2": "residencial la hacienda",
"address3": null,
"phone": null,
"fax": null,
"address_type": null,
"company_name": null
},
"destination": {
"country": "MX",
"postal_code": "66231",
"province": "NL",
"city": "San Pedro Garza García",
"name": "Jason Normore",
"address1": "Rio guadalquivir 422A",
"address2": "del valle",
"address3": null,
"phone": "7097433959",
"fax": null,
"address_type": null,
"company_name": null
},
"items": [
{
"name": "My Product 3",
"sku": null,
"quantity": 1,
"grams": 1000,
"price": 2000,
"vendor": "TestVendor",
"requires_shipping": true,
"taxable": true,
"fulfillment_service": "manual"
}
],
"currency": "MXN"
}
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment