I have 200K phone number and i want to get there city using truecaller , how to do that ? as you know truecaller has a restriction per requests ,,
somebody do this here : https://www.phphive.info/324/truecaller-api/
this is mycode :
$cookieFile = dirname(__file__) . DIRECTORY_SEPARATOR . 'cookies';
$no = $users[0];
$url = "https://www.truecaller.com/api/search?type=4&countryCode=sd&q=" . $no;
$ch = curl_init();
$header = array();
$header[] = 'Content-length: 0';
$header[] = 'Content-type: application/json';
$header[] = 'Authorization: Bearer i03~CNORR-VIOJ2k~Hua_GBt73sKJJmO';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieFile);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$data = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
$data = json_decode($data, true);
$name = $data['data'][0]['name'];
$altname = $data['data'][0]['altName'];
$gender = $data['data'][0]['gender'];
$about = $data['data'][0]['about'];
try my npm package truecallerjs
https://www.npmjs.com/package/truecallerjs
const truecallerjs = require('truecallerjs');
var countryCode = "IN"; // Default country code to use.
var installationId = "YOUR INSTALLATION ID";
var phoneNumbers = "+919912345678,+14051234567,+919987654321....." // Phone numbers seperated by comma's
const searchResult = truecallerjs.bulkSearch(phoneNumbers,countryCode,installationId)
searchResult.then(function (response) {
for (let i = 0; i < response.data.length; i++) {
if("undefined" === typeof response.data[i].value.addresses[0].city ) {
console.log(`${response.data[i].key} => Unkown city`);
} else {
console.log(`${response.data[i].key} => `,response.data[i].value.addresses[0].city);
}
}
})
// OUTPUT
// +919912345678 => Andhra Pradesh
// +14051234567 => Unkown city
// +919987654321 => Mumbai
// ...
// ...