更新时间:2023-11-27 21:43:22
此类授权不再有效.您需要通过 https://accounts.google.com/ServiceLogin
进行身份验证,然后获取 https://www.google.com/bookmarks/?output=rss
>
示例:
$USERNAME = 'aaa';$密码 = 'bbb';$ch = curl_init();curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (兼容; MSIE 6.0; Windows NT 5.1)");curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);curl_setopt($ch, CURLOPT_TIMEOUT, 120);curl_setopt($ch, CURLOPT_URL,'https://accounts.google.com/ServiceLogin?hl=en&service=bookmarks&continue=http://www.google.com/bookmarks');$data = curl_exec($ch);$formFields = getFormFields($data);//我的获取表单域的代码,问你是否想要$formFields['Email'] = $USERNAME;$formFields['Passwd'] = $PASSWORD;取消设置($formFields['PersistentCookie']);$post_string = '';foreach($formFields as $key => $value) {$post_string .= $key .'= .urlencode($value) .'&';}$post_string = substr($post_string, 0, -1);curl_setopt($ch, CURLOPT_URL, 'https://accounts.google.com/ServiceLoginAuth');curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);$result = curl_exec($ch);$info = curl_getinfo($ch);//echo var_dump($info);if ($info['url']=="https://accounts.google.com/ServiceLoginAuth"){die("登录失败");var_dump($result);} 别的 {curl_setopt($ch, CURLOPT_URL, 'http://www.google.com/bookmarks/?output=rss');curl_setopt($ch, CURLOPT_POST, 0);curl_setopt($ch, CURLOPT_POSTFIELDS, null);$result = curl_exec($ch);var_dump($result);}函数 getFormFields($data){if (preg_match('/(