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

curl-and-php

Re: Usinf Cookies & Secure connections

From: Sanket Gupta <sanket_at_tsucorp.net>
Date: Tue, 10 Sep 2002 11:37:32 +0530

Thanks sir!
That was a really useful reply.
I will try it out and then get back to you.
Thanks/Regards
Sanket Gupta
----- Original Message -----
From: "Dave Withnall" <withnall_at_connexus.net.au>
To: "Sanket Gupta" <sanket_at_tsucorp.net>
Sent: Tuesday, September 10, 2002 3:44 AM
Subject: Re: Usinf Cookies & Secure connections

>
> At 12:49 AM 10/09/2002 +0530, you wrote:
> >Hi,
> >I recently downloaded curl & found it to be good.
> >I would like to do the following
> >1.submit a login form to a site,
> >2.Accept the cookies returned
> >3.Use these cookies to read the member area pages.
> >I know this can be done thru curl & php.
> >But i dont know how.
> >I basically want to know how to use the cookies.
> >Please dont redirect me to the cookiejar.php example on the site as it
has
> >an undocumented fucntion
> >Setcookies()
> >which can not be found anywhere.
> >I would be greatful if you could arrange for a better example or
> >documentation.
> >Thanks/Regards
> >Sanket Gupta
>
> You don't need to use setcookies() for cURL to work.
> as for its documentation check out
> http://www.php.net/manual/en/function.setcookie.php
>
> The process can be done in the following fashion.
>
> 1. you create a cookiejar to store incoming cookies in.
> curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookieFileName");
>
> 2. you set your fields & tell curl to send them using POST
> curl_setopt($ch, CURLOPT_POST, 1);
> curl_setopt($ch, CURLOPT_POSTFIELDS, "UserID=username&password=passwd");
>
> 3. you set the URL you want to use
> curl_setopt($ch, CURLOPT_URL,"http://www.myterminal.com/checkpwd.asp");
>
> 4. then you submit it
> curl_exec ($ch);
>
> if you then look in /tmp/cookieFileName you will see the cookies that you
> were given by the www.myterminal.com
>
> 5. if you want to use these cookies to go futher around the site you use
> curl_setopt($ch1, CURLOPT_COOKIEFILE, "/tmp/cookieFileName");
>
> 6. then set the URL & execute
>
>
> and that is the whole extent of it.
> cURL automagically sends the cookies in /tmp/cookieFileName with the
second
> request.
>
>
>
>
>
>
>
>
>
>

-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone? Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
Received on 2002-09-10