Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/249.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 为什么我的谷歌端点总是一样的?_Php_Curl_Openid_Discovery - Fatal编程技术网

Php 为什么我的谷歌端点总是一样的?

Php 为什么我的谷歌端点总是一样的?,php,curl,openid,discovery,Php,Curl,Openid,Discovery,始终: 我有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 =

始终:

我有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);
XRD->Service->URI;
$request=$connection->begin($url);
$request always null…

看看Jeff在哪里解释了这种行为,以及用户可以做些什么:


好消息是,现在你可以了!谷歌刚刚以支持OpenID的形式给了我们一个美妙的感恩节礼物。使用谷歌个人资料,你可以选择一个你选择的命名URL 您的问题具有正确的端点URL(以
/ud
结尾的URL),但您的示例代码将请求发送到标识符URL(
/id
),而不是端点URL。

我上面的代码返回$URL,这实际上是正确的

问题是,您不需要使用openid php lib,只需使用如下查询字符串将用户重定向到: