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 = "Nimrod";
- $password = "Orco2010";
- $url = "https://platform.trafficoni.com/api/pull/customers";
- $key = "264388973aaa9b2f9eb2aa84a9c7382e";
- $sourceId=26;
- $jsonObj = array(
- 'from' => '2018-01-01 00:00:00',
- 'to' => date('Y-m-d H:i:s'),
- 'type' => '3'
- );
- 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);
- $resp = json_decode($result);
- //print_r($resp);
- if($resp->status){
- $data = $resp->data;
- //print_r($data);
- /*if(is_array($data)){
- foreach($data as $info){
- $customerData = $info->customerData;
- print_r($customerData); exit;
- $email = $customerData->email;
- $firstname = $customerData->firstname;
- $lastname = $customerData->lastname;
- $phone = $customerData->phone;
- $country = $customerData->countrcode;
- $ip = $customerData->ip;
- $firstDepositDate = $customerData->first_depositDate;
- $created_date = $customerData->created;
- echo "<br />".$email." ".$firstname." ".$lastname." ".$phone." ".$country." ".$ip." ".$created_date;
- }
- }*/
- }else{
- echo "Error fetching leads";exit;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement