1

我想登录到我的 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。我们知道的就这些。
4

0 回答 0