Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $apiURL = "https://api.livechatinc.com";
- $data = file_get_contents('php://input');
- $data = json_decode($data);
- $license_id = $data->license_id;
- $token = $data->token;
- $visitor_id = $data->visitor->id;
- $response = array();
- $data = array(
- 'name' => 'time',
- 'value' => time(),
- );
- $response[] = (object)$data;
- $postfields = http_build_query(array(
- 'license_id' => $license_id,
- 'token' => $token,
- 'id' => 'my-integration',
- 'fields' => $response
- ));
- // send request back to LiveChat API
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-API-Version: 2'));
- curl_setopt($ch, CURLOPT_URL, $apiURL.'/visitors/'.$visitor_id.'/details');
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
- $result = curl_exec($ch);
- curl_close($ch);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement