Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('display_errors', 1);
- error_reporting(E_ALL);
- $username = "M_DE_NORDIC_VIT";
- $password = "123456NC";
- $url = "https://platform.trackbox.com/api/pull/customers";
- $key = "264388973aaa9b2f9eb2aa84a9c7382e";
- $jsonObj = array(
- 'from' => '2018-01-01 00:00:00',
- 'to' => '2018-01-31 00:00:00',
- 'type' => '2'
- );
- try{
- $curl = curl_init($url);
- curl_setopt_array($curl, array(
- CURLOPT_RETURNTRANSFER => 1,
- CURLOPT_POST => 1,
- CURLOPT_HTTPHEADER => array("x-trackbox-username:".$username, "x-trackbox-password:".$password, "x-api-key:".$key, "Content-type:application/json"),
- CURLOPT_POSTFIELDS => json_encode($jsonObj),
- ));
- $result = curl_exec($curl);
- if (FALSE === $result)
- throw new Exception(curl_error($curl), curl_errno($curl));
- }catch(Exception $e) {
- trigger_error(sprintf(
- 'Curl failed with error #%d: %s',
- $e->getCode(), $e->getMessage()),
- E_USER_ERROR);
- }
- echo '<pre>';
- print_r($result);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement