我得到了wordpress openid ok。所以我认为只是发现阶段有一些问题..
<?php $ch = curl_init();
$url = 'https://www.google.com/accounts/o8/id';
$url = $url.'?';
$url = $url.'openid.mode=checkid_setup';
$url = $url.'&openid.ns=http://specs.openid.net/auth/2.0';
$url = $url.'&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select';
$url = $url.'&openid.identity=http://specs.openid.net/auth/2.0/identifier_select';
$url = $url.'&openid.return_to='.site_url().'/user/openid/login_callback';
$url = $url.'&openid.realm=http://www.example.com/';
// set url
curl_setopt($ch, CURLOPT_URL, $url);
//return the transfer as a string
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER,array("Accept: */*"));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
// $output contains the output string
$xdr = curl_exec($ch);
if (!$xdr) {
die(curl_error($ch));
}
// close curl resource to free up system resources
curl_close($ch);
$xml = new SimpleXMLElement($xdr);
$url = $xml->XRD->Service->URI;
$request = $connection->begin($url);
$ request总是为空......
答案 0 :(得分:0)
看看http://blog.stackoverflow.com/2009/11/google-offers-named-openids/,杰夫解释了这种行为以及用户可以做些什么:
好消息是,现在你可以!谷歌只是以Google Profiles支持OpenID的形式给了我们一个精彩的感恩节礼物。使用Google个人资料,您可以选择自己选择的命名网址。
答案 1 :(得分:0)
您的问题有正确的端点网址(以/ud
结尾的网址),但您的示例代码是将请求发送到标识符网址(/id
),而不是端点网址。
答案 2 :(得分:0)
我的上述代码确实在$ url中返回https://www.google.com/accounts/o8/ud,这实际上是正确的
问题是,您不需要使用openid php lib,只需将用户重定向到https://www.google.com/accounts/o8/ud,查询字符串如下:
https://www.google.com/accounts/o8/ud?openid.mode=checkid_setup& ......