I was wondering how to extract data from the body of a HTTP 200 ok Header using PHP. What I am trying to do is to write a light weight GUI that connects to google Calendar[www.google.com/calendar] ! Why do this : Simple my cellphone does not support AJAX and I want to be able to update the calendar on the move from my cell !! I am sending the username along with password and a couple of other variables that google needs , to their authentication url [ http://francis.byethost22.com/googlelogin.php ] . In response it sends back a Auth token which I need to place in a cookie . How on god's green earth do I extract the token !!
Francis . Warm Summerr !!
On 5/20/06, Francis mail.francispereira@gmail.com wrote:
http://francis.byethost22.com/googlelogin.php ] . In response it sends back a Auth token which I need to place in a cookie . How on god's green earth do I extract the token !!
If its a cookie you're after, then the HTTP server would send that in the header. i.e. the "Set-Cookie" header
Once you extract the relevant cookie, the client should send that back as a "Cookie" header.
Rohan R. Almeida wrote:
If its a cookie you're after, then the HTTP server would send that in the header. i.e. the "Set-Cookie" header
Once you extract the relevant cookie, the client should send that back as a "Cookie" header.
Rohan , Yes I want to create a cookie of the Auth token . The server is not sending a cookie . Please try loging in using http://francis.byethost22.com/googlelogin.php and see On successfull login your browser will show up a a Auth . I am looking to capture this variable so that I can then create a cookie out of it !!
Francis Warm Summer !!
Finallly the Auth token has been extracted . Manged to do this by sending a raw POST request and getting the reply . Just for old time sake if any one is intrusted I have pasted the code below. This brings me to another issue. What domain name can I register example can I register googlemobilecalendar.<some free hosting>.com ?? What are the legal implications . Or should i just keep it on a private address just for myself . Keeping it for myself is kinda Sad and a good waste of all development time .
the PHP code for obtaining the Auth token <?php $mailid=<your email id here>; $pass=<your password> $host="66.102.7.99"; $method="post"; $path="/accounts/ClientLogin"; $data="Email=". $mailid. "&Passwd=" . $pass . "&service=cl&source=calendar-lightweightmobilever-1"; $method = strtoupper($method); $fp = fsockopen('ssl://'.$host, 443); echo $fp; fputs($fp, "$method $path HTTP/1.1\r\n"); fputs($fp, "Host: $host\r\n"); fputs($fp,"Content-Type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-Length: " . strlen($data) . "\r\n"); fputs($fp, "Connection: Close\r\n\r\n"); fputs($fp, $data); while (!feof($fp)) { $buf .=fgets($fp); } fclose($fp); print $buf; ?>
Franics Pereira Warm Summers
Rohan R. Almeida wrote:
On 5/20/06, Francis mail.francispereira@gmail.com wrote:
http://francis.byethost22.com/googlelogin.php ] . In response it sends back a Auth token which I need to place in a cookie . How on god's green earth do I extract the token !!
If its a cookie you're after, then the HTTP server would send that in the header. i.e. the "Set-Cookie" header
Once you extract the relevant cookie, the client should send that back as a "Cookie" header.