1

私はオープン ID を初めて使用しますが、それでもオープン ID を自分の Web サイトに統合しようとしました。yahoo プロバイダーを使用して自分の Web サイトにログインしています。yahoo mail id 、 first name 、 last name などのユーザー情報を取得するのに役立つものはありますか。

Google に提供されている Web サイトから以下のコードを取得しました。プロバイダーを yahoo に変更しました。

私が試したコード:

<?php
# Logging in with Google accounts requires setting special identity, so this example shows how to do it.
require 'openid.php';
try {
# Change 'localhost' to your domain name.
$openid = new LightOpenID('localhost');
if(!$openid->mode) {
if(isset($_GET['login'])) {
$openid->identity = 'https://me.yahoo.com';
header('Location: ' . $openid->authUrl());
}
?>
<form action="?login" method="post">
<button>Login with Yahoo</button>
</form>
<?php
} elseif($openid->mode == 'cancel') {
echo 'User has canceled authentication!';
} else {
echo 'User ' . ($openid->validate() ? $openid->identity . ' has ' : 'has not ') . 'logged in.';
print_r($openid->ax_to_sreg);
}
} catch(ErrorException $e) {
echo $e->getMessage();
}

ログイン後、次のように出力されます:

User https://open.login.yahooapis.com/openidx20/user_profile/XXXX has logged in.

上記のURLは何に使用されますか?ユーザー情報を取得するにはどうすればよいですか?

4

1 に答える 1