{ "state": 200, "data": "api07-28fada04-5393-442a-a2fd-415a22bf0b2c" }
State | Data type | Description |
---|---|---|
200 | String | Successfully |
Name | Description | Type | Default value | Required |
---|---|---|---|---|
site_id | Site ID | Integer | Yes | |
visitor_id | Visitor ID | String | Yes | |
page | Page url | String | Yes | |
referer | Referer url | String | Yes | |
session_id | Session ID | String | Yes | |
fingerprint | Webstat fingerprint ID | String | Yes |
{ "state": 200, "data": true }
State | Data type | Description |
---|---|---|
200 | True | Successfully |
404 | False | Not all fields are filled |
Name | Description | Type | Default value | Required |
---|---|---|---|---|
session_id | Session ID | String | Yes | |
fingerprint | Webstat fingerprint ID | String | Yes | |
width | Screen width | Integer | Yes | |
height | Screen height | Integer | Yes | |
movements | Array of events | Array | Yes |
{ "state": 200, "data": true }
State | Data type | Description |
---|---|---|
200 | True | Successfully |
404 | False | Not all fields are filled |
Name | Description | Type | Default value | Required |
---|---|---|---|---|
ids | List of visitors IDs | Array | Yes |
{ "state": 200, "data": true }
State | Data type | Description |
---|---|---|
200 | [] | Successfully |
404 | [] | Visitors not found |
$ids = array( "api04-3868bf2f-9e12-4bb7-aae5-207b198a1d51" ); $result = tazeros_upgrade_visitor_ids($ids); print_r($result); function tazeros_upgrade_visitor_ids($ids){ if(is_array($ids)){ $ids = array_values($ids); $requests = $result = array(); foreach($ids as $key => $value){ $value = explode("-", htmlspecialchars($value)); if(count($value) == 6){ if(!isset($requests[$value[0]])) $requests[$value[0]] = array(); $requests[$value[0]][] = implode("-", array($value[1], $value[2], $value[3], $value[4], $value[5])); } } foreach($requests as $api => $ids){ for($i = 0; $i < count($ids) / 1000; $i++){ $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "https://".$api.".tazeros.com"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, array( "token" => "TOKEN", "module" => "webstat", "controller" => "visitors", "method" => "get", "attributes" => json_encode(array( "ids" => array_slice($ids, $i * 1000, 1000) )) )); $response = json_decode(curl_exec($curl), TRUE); curl_close($curl); if(isset($response["response"]["state"]) && $response["response"]["state"] == 200){ foreach($response["response"]["data"] as $visitor){ $result[] = $visitor; } } } } return $result; }else{ return false; } }