cURL / Mailing Lists / curl-library / Single Mail

curl-library

Posting cookies along with form data

From: preetic <preetic_at_mahiti.org>
Date: Wed, 31 Jul 2002 17:37:14 +0530

Hi all!!

I am trying to create an application in which the client(browser)send
login info(required to log in to a website) to the server and the server
returns the logged in page along with the cookies.I save the cookies on
the hard disk and want to go to another page of the website and update
some information in it.For this i want to post the cookie file along with
the data to be updated.
Th code that i have written is functioning correctly without me sending
the cookies back..I am not able to understand how is this working? I am
basically popsting cookies back so that the server remembers the login
info and lets me access any page of that website.Do i need to send the
cookies to the server?If so how to do so?
MY code is as follows:_
import pycurl
import urllib
curl=pycurl.init()
curl.setopt(pycurl.URL,'http://www.zope.org/logged_in.html')
dataread="__ac_name=ABC&__ac_password=wvfdgghYf&submit=Login&came_from=http://www.zope.org/login.html"
curl.setopt(pycurl.POST,1)
curl.setopt(pycurl.POSTFIELDS,dataread)
curl.setopt(pycurl.COOKIEJAR,'my.txt')
curl.perform()
#cookiefile=open('my.txt','r')
#cookieread=cookiefile.readlines()
curl.setopt(pycurl.POST,1)
#curl.setopt(pycurl.HTTPPOST,cookieread)
curl.setopt(pycurl.URL,'http://www.zope.org/Members/ABC/updateMember')
dataupdate=urllib.urlencode({'full_name':'ABCS','company':'mvbvbv','email':'preetic_at_mahiti.org','submit':'Save
Changes'})
curl.setopt(pycurl.POSTFIELDS,dataupdate)
cucurl.perform()
curl.cleanup()

Can anyone please help me in clearing my doubts?

Cheers

Preeti

-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31
Received on 2002-07-31