Skip to content

Instantly share code, notes, and snippets.

@acolin
Created August 11, 2016 20:05
Show Gist options
  • Save acolin/5e0c2a789dae3c20cd94816d24274cd0 to your computer and use it in GitHub Desktop.
Save acolin/5e0c2a789dae3c20cd94816d24274cd0 to your computer and use it in GitHub Desktop.
<?php
$request = new HttpRequest();
$request->setUrl('http://54.191.139.107/api/v2/orders');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'postman-token' => '72790ff2-fc6e-6077-60d6-547bd112996d',
'cache-control' => 'no-cache',
'content-type' => 'application/json'
));
$request->setBody('{
"api_key": "abcdefghijk",
"delivery": {
"email": "[email protected]",
"municipality": "San Pedro Garza Garcia",
"name": "Arturo Gomez",
"street_name_and_number": "Rio rosas 101",
"neighborhood": "del valle",
"telephone": "8114689871"
},
"pickup": {
"email": "[email protected]",
"municipality": "San Pedro Garza Garcia",
"name": "skydrop tienda online",
"street_name_and_number": "Rio Guadalquivir 422-A",
"neighborhood": "del valle",
"telephone": "814040 5222"
},
"service": {
// starting_hour & ending_hour must be greater than current time
"starting_hour": "16:00",
"ending_hour": "18:00",
// schedule_date must be the current date yyyy-mm-dd
"schedule_date": "2016-08-11",
"service_code": "EExps",
"vehicle_type": "car"
}
}');
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