tags:

views:

24

answers:

0

I have created the function below to check is the auth code is valid with Google, but could anyone point me in the right direction on how to actually grab the users details from there account using the API such as their first name and second name.

function check_google_auth_code($authtoken){ /* * Returns The HTTP Code From Google * 200 Is Returned If The Auth Token Is Valid. */

    $ch = curl_init("http://www.google.com/reader/atom/user/-/state/com.google/reading-list");
    $header[] = 'Authorization: GoogleLogin auth='.$authtoken;

    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_TIMEOUT, 2);

    $xml = curl_exec($ch);
    $info = curl_getinfo($ch);
    curl_close($ch);

    return $info['http_code'];

}