Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2018
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.01 KB | None | 0 0
  1.     $username = "Nimrod";
  2.         $password = "Orco2010";
  3.         $url = "https://platform.trafficoni.com/api/pull/customers";
  4.         $key = "264388973aaa9b2f9eb2aa84a9c7382e";
  5.  
  6. try{
  7.                 $curl = curl_init($url);
  8.  
  9.                 curl_setopt_array($curl, array(
  10.                 CURLOPT_RETURNTRANSFER => 1,
  11.                 CURLOPT_POST => 1,
  12.                 CURLOPT_HTTPHEADER => array("x-trackbox-username:".$username, "x-trackbox-password:".$password, "x-api-key:".$key, "Content-type:application/json"),
  13.                 CURLOPT_POSTFIELDS => json_encode($jsonObj),
  14.                 ));
  15.                 $result = curl_exec($curl);
  16.  
  17.                 if (FALSE === $result)
  18.                 throw new \Exception(curl_error($curl), curl_errno($curl));
  19.  
  20.             }catch(\Exception $e) {
  21.                 trigger_error(sprintf(
  22.                     'Curl failed with error #%d: %s',
  23.                     $e->getCode(), $e->getMessage()
  24.                 ),
  25.                 E_USER_ERROR);
  26.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement