Google Client auth Login with PHP and Curl

// Construct an HTTP POST request
$clientlogin_url = "https://www.google.com/accounts/ClientLogin";
$clientlogin_post = array(
    "accountType" => "HOSTED_OR_GOOGLE",
    "Email" => "yourgoogle@email.com",
    "Passwd" => "yourgooglepassword",
    "service" => "writely",
    "source" => "your application name"
);

// Initialize the curl object
$curl = curl_init($clientlogin_url);

// Set some options (some for SHTTP)
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $clientlogin_post);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

// Execute
$response = curl_exec($curl);

// Get the Auth string and save it
preg_match("/Auth=([a-z0-9_\-]+)/i", $response, $matches);
$auth = $matches[1];

echo "The auth string is: " . $auth;
// Include the Auth string in the headers
// Together with the API version being used
$headers = array(
    "Authorization: GoogleLogin auth=" . $auth,
    "GData-Version: 3.0",
);

// Make the request
curl_setopt($curl, CURLOPT_URL, "{Google service feed link}");
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_POST, false);

$response = curl_exec($curl);
curl_close($curl);

// Parse the response
$response = simplexml_load_string($response);

echo "<pre>";
print_r($response); 
echo "</pre>";

Facebook comments:

359 thoughts on “Google Client auth Login with PHP and Curl

  1. Pingback: marketing online

  2. Pingback: best diet pills

  3. Pingback: cheap logo design

  4. Pingback: vivienne westwood pirate boots

  5. Pingback: facebook of sex

  6. Pingback: What is Wrap-Around Mortgage?

  7. Pingback: Credit Card Debt Elimination

  8. Pingback: Orlando real estate

  9. Pingback: unique hoodia reviews

  10. Pingback: sex face book

  11. Pingback: how to talk to girls

  12. Pingback: Italian Meet People

  13. Pingback: Calgary Wedding Photography

  14. Pingback: collection agency

  15. Pingback: nose aspirator

  16. Pingback: how to meditate properly

  17. Pingback: Thank you!

  18. Pingback: {Nivea coupons|Nivea coupon|Nivea printable coupon|Nivea printable coupons|Nivea discounts|Nivea discount|Nivea promo|Nivea promo code}

  19. Pingback: collection agency newsletter

  20. Pingback: {Cascade coupons|Cascade coupon|Cascade printable coupon|printable Cascade coupons|Cascade dishwasher detergent|Cascade discount}

  21. Pingback: Golden Corral coupons

  22. Pingback: Blue Buffalo printable coupons

  23. Pingback: Stride Rite coupon

  24. Pingback: perth child care

  25. Pingback: graphic design perth

  26. Pingback: network marketing

  27. Pingback: seo australia

  28. Pingback: wedding photographer calgary

  29. Pingback: senuke x

  30. Pingback: Sztabki złota is really greatproduct

  31. Pingback: Aimane

  32. Pingback: Contour Abs Review

  33. Pingback: facebook of sex

  34. Pingback: facebbok of sex

  35. Pingback: Aboubakar

  36. Pingback: best dating site

  37. Pingback: Meet Girls Online Free

  38. Pingback: Free Meet People

  39. Pingback: 5 Panel Drug Test

  40. Pingback: Meeting People Online For Free

  41. Pingback: Griddle Pans

  42. Pingback: Free Meet People Sites

  43. Pingback: Meet Single

  44. Pingback: amazon money machine scam

  45. Pingback: Norwalk house painting

  46. Pingback: argumentative topics

  47. Pingback: Meet People Online For Free

  48. Pingback: blogger or wordpress

  49. Pingback: Stop Smoking Cigarettes Now!

  50. Pingback: Para Ma

Leave a Reply