为什么我的Google终端始终如此?

为什么我的Google终端始终如此?

问题描述:

总是:https://www.google.com/accounts/o8/ud为什么我的Google终端始终如此?

我得到了wordpress openid ok。所以我觉得仅仅是发现阶段有一些probelms ..

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

$请求总是空...

看看http://blog.*.com/2009/11/google-offers-named-openids/杰夫解释这种行为,什么用户可以做它:

好吧,好消息是,现在你可以! Google刚刚以 Google Profiles的形式为我们提供了一个奇妙的感恩节,支持OpenID。使用Google个人资料,您可以选择一个您选择的指定网址!

您的问题有正确的端点URL(以/ud结尾的端点URL),但示例代码正在将请求发送到标识符URL(/id),而不是端点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& ......