I cant figure out cookies and curls...

Status
Not open for further replies.

Rascagua

New member
Jun 18, 2007
281
3
0
Im trying to login to a site that requires cookies to stay logged in...

but I cant get it to store any cookies... im running the scripts of my localhost...

its all curl, can you point me to a tutorial or something! THANK You very much.
 


Code:
import pycurl

def setup_curl(url):
  c = pycurl.Curl()
  c.setopt(pycurl.URL, url)
  c.setopt(pycurl.COOKIEFILE, '')
  return c
 
I've set the cookie file and cookie jar options to the same value. This may not be correct usage but it works for me.

Code excerpt (don't use Python; this is in PHP but should be pretty obvious):
Code:
$curl= curl_init($URL);
$cookiefile="cookie";
...
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_COOKIEFILE, $cookiefile);
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookiefile); # SAME cookiefile
...
 
Last edited:
Status
Not open for further replies.