1

Google アカウントにログインしてから、特定のURLにリダイレクトしたいと考えています。統計を含むcsvファイルを取得するためにそれを行いたいです。私の質問は、ログインして前述の URL にリダイレクトするにはどうすればよいですか? これをバックエンドで実行したいのですが、ユーザー名とパスワードは常に同じであるため、提供したくありません。以下のコードを使用してログインしましたが、次の応答が返ってきました

<?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