Created
August 11, 2016 19:56
-
-
Save acolin/ec61aee7dad7f340c788fc7dc03ab19c to your computer and use it in GitHub Desktop.
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 | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => "http://54.191.139.107/api/v2/shipping_rates", | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_ENCODING => "", | |
CURLOPT_MAXREDIRS => 10, | |
CURLOPT_TIMEOUT => 30, | |
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, | |
CURLOPT_CUSTOMREQUEST => "POST", | |
CURLOPT_POSTFIELDS => "{\n \"rate\": {\n \"origin\": {\n \"country\": \"MX\",\n \"postal_code\": \"64898\",\n \"province\": \"NL\",\n \"city\": \"Monterrey\",\n \"name\": null,\n \"address1\": \"hda. cataluña 4941\",\n \"address2\": \"residencial la hacienda\",\n \"address3\": null,\n \"phone\": null,\n \"fax\": null,\n \"address_type\": null,\n \"company_name\": null\n },\n \"destination\": {\n \"country\": \"MX\",\n \"postal_code\": \"66231\",\n \"province\": \"NL\",\n \"city\": \"San Pedro Garza García\",\n \"name\": \"Jason Normore\",\n \"address1\": \"Rio guadalquivir 422A\",\n \"address2\": \"del valle\",\n \"address3\": null,\n \"phone\": \"7097433959\",\n \"fax\": null,\n \"address_type\": null,\n \"company_name\": null\n },\n \"items\": [\n {\n \"name\": \"My Product 3\",\n \"sku\": null,\n \"quantity\": 1,\n \"grams\": 1000,\n \"price\": 2000,\n \"vendor\": \"TestVendor\",\n \"requires_shipping\": true,\n \"taxable\": true,\n \"fulfillment_service\": \"manual\"\n }\n ],\n \"currency\": \"MXN\"\n }\n }", | |
CURLOPT_HTTPHEADER => array( | |
"cache-control: no-cache", | |
"content-type: application/json", | |
"postman-token: 18fe984c-bb62-8f56-017a-495108d1ace1" | |
), | |
)); | |
$response = curl_exec($curl); | |
$err = curl_error($curl); | |
curl_close($curl); | |
if ($err) { | |
echo "cURL Error #:" . $err; | |
} else { | |
echo $response; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment