Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $username = "Nimrod";
- $password = "Orco2010";
- $url = "https://platform.trafficoni.com/api/pull/customers";
- $key = "264388973aaa9b2f9eb2aa84a9c7382e";
- 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);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement