cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Posting with curl

From: Rafael Barbosa <rrbarbosa_at_gmail.com>
Date: Sat, 17 May 2008 14:04:22 +0200

Hello again,

Allow me to answer myself. The behavior I saw has nothing to do with curl
(as far as my reduced shell knowledge goes). The problem was calling the
second command wrongly.

Instead of:
curl -b $cookie_file -d "\"$EVENT\""
http://www.myserver.com/wiki/index.php/Special:AddArticle >> $log_file

should be:
curl -b $cookie_file -d "{$EVENT}"
http://www.myserver.com/wiki/index.php/Special:AddArticle >> $log_file

Sorry for disturbing you for nothing...

Best regards,
Rafael

On Sat, May 17, 2008 at 12:52 PM, Rafael Barbosa <rrbarbosa_at_gmail.com>
wrote:

> Hello there,
>
> I've been making some simple scripts with curl for about 1 month now. My
> goals are simple, I have a http form that insert new wiki pages in a server.
> The parameters are only 3, pagetitle, namespace and text.
>
> So far my script generates a text file with the three parameters in a
> separating the parameters by '&', and the after some checks, i call the
> 'curl' command to perform the post, so far no promblems, the pages are
> inserted correctly. Now I discover that this aproach is not quite good, as
> is possible that if two process are executing my script, one could write the
> file and the second overwrite it, before the curl command of the first
> proccess is executed.
>
> As a workaround, i tryed not to save the file, and form send the string
> directly from the variable I had, but it just doesnt work. Is there any
> thing I should pay attention while changing the command from:
>
> curl -b $cookie_file -d @$event_file
> http://www.myserver.com/wiki/index.php/Special:AddArticle >> $log_file
> 2>&1
>
> to
>
> curl -b $cookie_file -d "\"$EVENT\""
> http://www.myserver.com/wiki/index.php/Special:AddArticle >> $log_file
>
> Notice that before I simply called echo $EVENT > $event_file, and it
> work... the content of the text file and the variable are the same.
>
> Thanks in advance,
> Rafael Barbosa
>
Received on 2008-05-17