从truecaller中抓取数据

时间:2017-12-30 10:50:46

标签: web-scraping extract

我有200K的电话号码,我想使用truecaller到达那个城市,怎么做? 如你所知,truecaller对每个请求都有限制,

有人这样做: https://www.phphive.info/324/truecaller-api/

这是我的代码:

 $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'];

0 个答案:

没有答案
相关问题