What's the simplest way to request an email address from an OpenID provider?
Is there a good PHP library that simplifies this problem?
I know that providers implement things differently. I've heard you need to do both Simple Registration and Attribute Exchange. I'd particularly want to make sure that it worked with the biggest providers, such as MyOpenID and Google.
Related, but inadequate, questions:
JanRain has a Open ID PHP Library, one of the first libraries (I believe) from a company centric to OpenID. You mentioned working with MyOpenID, which JanRain's site.
That said, personally I use the Zend Library now (I played with the JanRain library years ago), just because I generally develop using the Zend Framework.
Here are some code examples if the provider uses the OpenID Simple Registration Extension.
This section of the Zend Reference guide shows how to request user information with the authentication request. Here's their example code edited for your needs:
Accomplishing the same with the JanRain library is similar, here's some code taken from from the try_auth.php file of the library package (I edited it to show the basic functions you're looking for):
For Attribute Exchange check out the JanRain Auth_OpenID_AX Classes, in the Zend Library there's a feature request for AX support.