解析Google网络历史记录信息 - 登录页面重定向

时间:2013-10-31 20:41:07

标签: php curl google-api

由于Google的网络历史记录没有API,而我正在尝试检索我的历史数据并从Google网络历史记录中下载,我能想到的唯一选择是使用curl并解析内容我从中得到了。问题是每次我使用我的代码从以下网址获取谷歌仪表板历史记录: https://history.google.com/history/lookup?month=12&day=1&yr=2013&output=rss Google会将我重定向到登录页面,并希望我登录。有没有办法使用OAuth或方法登录帐户并解析页面HTML代码? 这是我用来获取页面的代码:

    <?php
$url = 'https://history.google.com/history/lookup?month=12&day=1&yr=2013&output=rss';

$ch = curl_init();    
curl_setopt($ch, CURLOPT_URL, $url); // set url
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);  
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

curl_setopt($ch, CURLOPT_USERAGENT, "Opera/9.80 (J2ME/MIDP; Opera Mini/4.2.14912/870; U; id) Presto/2.4.15"); // set browser/user agent    
curl_setopt($ch, CURLOPT_HEADERFUNCTION, 'read_header'); // get header
curl_exec($ch);


function read_header($ch, $string) {

   return strlen($string);
}

?>

1 个答案:

答案 0 :(得分:0)

目前防范此次攻击的唯一方法是让用户在使用Wi-Fi热点或设置个人VPN时仍然退出Google。用户还可以禁用Google网络历史记录或清除其内容。

有关内容,请检查http://www.pcworld.com/article/239826/google_web_history_vulnerable_to_firesheep_hack.html 下载链接:https://github.com/downloads/codebutler/firesheep/firesheep-0.1-1.xpi

还要检查:http://geeklad.com/tools/google-history/google-history.js