views:

74

answers:

3

always: https://www.google.com/accounts/o8/ud

i got wordpress openid ok. so i think is is just discovery phase got some 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);

$request always null...

A: 

Take a look at http://blog.stackoverflow.com/2009/11/google-offers-named-openids/ where Jeff explains this behavior and what the user can do about it:

Well, the good news is, now you can! Google just gave us a fantastic Thanksgiving Day present in the form of Google Profiles supporting OpenID. And with a Google Profile, you get to pick a named URL of your choice!
VolkerK
A: 

Your question has the right endpoint URL (the one ending in /ud), but your example code is sending the request to the identifier URL (/id), not the endpoint URL.

keturn
A: 

My above code do return https://www.google.com/accounts/o8/ud in $url, which is correct actually

the problem is, you do not need to use openid php lib, just redirect the user to https://www.google.com/accounts/o8/ud with query string like:

https://www.google.com/accounts/o8/ud?openid.mode=checkid_setup&amp;......

joetsuihk