cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

[Help] : Gmail login with CURL

From: ⎝ VishwānaŦh ⎠® ™ Dalvi <vishwanath.response_at_gmail.com>
Date: Wed, 21 Apr 2010 08:10:08 +0530

Hello sir,

I'm trying to automatically login into curl using following code

But the following code gives two errors .. one is of base_directory
error,and one is gacookie..

sir can you tell me you to set cookie on web server (Server side cookies or
persistent session) using
following code.

Sir,Please guide us we are searching for this solution
since past 2 weeks.

http://www.copypastecode.com/27076/

<?php
$username=urlencode('xyzintegra_at_gmail.com');
$password="integra123";
$gacookie="./.gmcookie";
//&service=blogger

$postdata="Email=$username&Passwd=$password
&GA3T=5AS_gBsvDHI&nui=15&fpui=3&"."&ifr=true&rm=hide&itmpl=true&hl=en_US&alwf=true&continue=
http://www.google.com/mail";
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL,"
https://www.google.com/accounts/ServiceLoginBoxAuth");
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT
5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_COOKIEJAR, $gacookie);
curl_setopt ($ch, CURLOPT_COOKIEFILE, $gacookie);
curl_setopt ($ch, CURLOPT_REFERER, '
https://www.google.com/accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F%3Fnsr%3D1%26ui%3Dhtml%26zy%3Dl&ltmpl=default&ltmplcache=2'
);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt ($ch, CURLOPT_POST, 1);
$result = curl_exec ($ch);
curl_close($ch);
echo $result;
unlink($gacookie);
exit;
?>

hoping for your kind consideration.

Regards,
Vishwanath Dalvi

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2010-04-21