0

总是:https ://www.google.com/accounts/o8/ud

我得到了 wordpress openid 好的。所以我认为只是发现阶段有一些问题..

<?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 始终为空...

4

3 回答 3

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& ......

于 2010-03-17T01:06:01.830 回答
0

看看https://blog.stackoverflow.com/2009/11/google-offers-named-openids/其中 Jeff 解释了这种行为以及用户可以做些什么:

好消息是,现在你可以了!谷歌刚刚以支持 OpenID的谷歌个人资料的形式给了我们一个很棒的感恩节礼物。借助 Google 个人资料,您可以选择自己喜欢的命名 URL!
于 2010-03-16T08:36:10.867 回答
0

您的问题具有正确的端点 URL(以 结尾/ud),但您的示例代码将请求发送到标识符 URL ( /id),而不是端点 URL。

于 2010-03-16T18:43:59.747 回答