Viewing
campaign/geo
Parameters:
Example of the method request:
<?php $post = array( 'token' => $token, 'id' => 999999 ); if ($curl = curl_init()) { curl_setopt($curl, CURLOPT_URL, 'https://www.ipweb.ru/api/v2/campaign/geo'); curl_setopt($curl, CURLOPT_RETURNTRANSFER,true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $post); $out = curl_exec($curl); echo $out; curl_close($curl); } // Result: { "countries": { "geo_ru": { "name": "Russia", // region name "checked": true, // selected or not "count": 84836 // approximate number of visits per day }, "geo_ua": { "name": "Ukraine", "checked": false, "count": 22551 }, ... }, "ru_regions": { "region_105": { "name": "Moscow", "checked": true, "count": 17419 }, "region_106": { "name": "Saint Petersburg", "checked": true, "count": 5551 }, ... }, "ua_regions": { "region_10": { "name": "Kiev", "checked": false, "count": 9226 }, "region_21": { "name": "Donetsk region", "checked": false, "count": 3692 }, ... }, "error_code": 0 }
Setting Regions
campaign/geo_set_by_names
Parameters:
Параметр regions can also contain the code or names of the macroregion:
Example of the method request:
<?php $post = array( 'token' => $token, 'id' => 999999, 'regions' => 'moscow,spb,yaroslavl,sverdlovsk' ); if ($curl = curl_init()) { curl_setopt($curl, CURLOPT_URL, 'https://www.ipweb.ru/api/v2/campaign/geo_set_by_names'); curl_setopt($curl, CURLOPT_RETURNTRANSFER,true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $post); $out = curl_exec($curl); echo $out; curl_close($curl); } // Result: { "status": "ok", "error_code": 0 } $post = array( 'token' => $token, 'id' => 999999, 'regions' => 'portuguese_language,English language' ); if ($curl = curl_init()) { curl_setopt($curl, CURLOPT_URL, 'https://www.ipweb.ru/api/v2/campaign/geo_set_by_names'); curl_setopt($curl, CURLOPT_RETURNTRANSFER,true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $post); $out = curl_exec($curl); echo $out; curl_close($curl); } // Результат: { "status": "ok", "error_code": 0 }