0

Trouble Getting Yadis document through Curl/PHP

I'm trying to implement openid on a website I am building using the PHP library here. Unfortunately though it doesn't seem to support Yadis.

I have no trouble getting Google's file, but I can't seem to access Yahoo's. According to your documentation here, http://yahoo.com is the location of the document, but in order to access it, I need to send a HTTP Header requesting a application/xrds+xml document.

I am trying to use cURL in PHP to obtain access to it, and this is the code I have so far:

CODE
<?php
// create a new cURL resource
$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://yahoo.com/");
$headers = array("Accept: application/xrds+xml");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

// grab URL and pass it to the browser
curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);
?>


However when I run that page, I only get this response:

QUOTE
The document has moved here.


If anyone can offer me help, I could greatly appreciate it

by
2 Replies
  • If you get http return code 301, 302, 303, 307...
    You'll have to make another request to the redirected url, until you get return code 200 or 206

    but this is too fundamental, I believe there must be some 'discovery' function for you to use.
    0
  • Hi garionw,

    As said in Rick's email, you need to follow redirects until it returns
    content with HTTP code 200. Since this is all too low-level, you may consider
    using the OpenID PHP library http://openidenabled.com/ to do the
    heavy lifting for you.

    Thanks,
    Yu Wang
    Yahoo! Membership team
    0

Recent Posts

in OpenID General Discussion