登录谷歌帐户

时间:2013-02-04 13:29:59

标签: php redirect

我想登录我的Google帐户,然后我想重定向到特定的url。我想这样做,以便检索带有统计信息的csv文件。所以我的问题是如何登录并重定向到上述网址?我希望这发生在后端,我不想提供用户名和密码,因为这将始终是相同的。我已使用下面的代码登录,但我采取以下回复

<?php

require 'openid.php';
try {
  $openid = new LightOpenID('https://www.google.com');
  if (!$openid->mode) {

    $openid->identity = 'https://www.google.com/accounts/o8/id';
    $openid->required = array('namePerson/first', 'namePerson/last', 'contact/email');
    header('Location: ' . $openid->authUrl());
    if ($openid->validate()) {
        echo 'User <b>' . $openid->identity . '</b> has logged in.<br>';

        echo "<h3>User information</h3>";

        $identity = $openid->identity;
        $attributes = $openid->getAttributes();
        $email = 'alexdowining@gmail.com';
        $first_name = 'Alex';
        $last_name = 'Dowining';

        echo "mode: " . $openid->mode . "<br>";
        echo "identity: " . $identity . "<br>";
        echo "email: " . $email . "<br>";
        echo "first_name: " . $first_name . "<br>";
        echo "last_name: " . $last_name . "<br>";
    } else {
        echo 'User ' . $openid->identity . 'has not logged in.';
    }
}
} catch (ErrorException $e) {
  echo $e->getMessage();
}

 ?>
  1. 这是一个错误。您要求的服务目前无法使用。服务错误-27。这就是我们所知道的。

0 个答案:

没有答案