curl-library
Re: Trouble using POSTFIELDS
Date: Fri, 16 Aug 2002 14:58:24 +0200 (MET DST)
On Fri, 16 Aug 2002, preetic wrote:
> Am facing a major problem.Am creating an application that is trying to add
> a new course in a site which has date as one of the field values.The date
> is stored as a list (eg [2,2,2002]) n then at the database level is
> converted in the date format and saved.
> My problem is that when i post the data using POSTFIELDS the data is
> converted into a string and therefore at the database level the query which
> adds the data to the database is not able to identify the date as it gets a
> string instead of a list.
I think you are seriously confusing matters here now.
There is only one way to pass data using POST to a web server. That is
passing all the data in one huge chunk to the other end. The big chunk is
normally (but not necessarily) divided into &-separated units for each
"variable" to pass. Each variable must get its contents written in plain text
like "variable=contents".
There is no way in this system to indicate weather 'contents' is a number,
string, date, shoe size or IQ number. They're all alike to the big bad POST
gods.
> The data is not added to the database as result.
I very much doubt that this is the reason.
> curl.setopt(pycurl.URL,'http://asd/courseadd')
> datadictionary=(asddictionary.infodictionary)#this is the dictionary of
> #form field values containin the date in the list
> dataupdate=urllib.urlencode(datadictionary)
> curl.setopt(pycurl.POST,1)
> curl.setopt(pycurl.POSTFIELDS,dataupdate)
> curl.perform()
I think this looks like perfectly valid curl use.
-- Daniel Stenberg -- curl related mails on curl related mailing lists please ------------------------------------------------------- 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=vs3390Received on 2002-08-16