cURL / Mailing Lists / curl-library / Single Mail


Re: finally

From: Nick Chirca <>
Date: Thu, 8 Nov 2001 16:18:08 +0200 (EET)

> On Wed, 7 Nov 2001, Nick Chirca wrote:
> > I am trying to fill in a form, a text message that I get from a file.
> >
> > open F,"text.file";
> > @data=<F>;
> > close F;
> > Curl::easy::setopt($curl, Curl::easy::CURLOPT_POSTFIELDS, \@data);
> Set CURLOPT_VERBOSE to 1 and you'll get to see the entire HTTP request curl
> makes, it often explains enough.

I did that, but I couldn't realize what the problem is. The data from that
text file is not sent. Attached you can find the output of the script,
using the verbose option of curl.

> I bet this fails because CURLOPT_POSTFIELDS wants a string, not an array
> reference.
> Try something like this:
> Curl::easy::setopt($curl, Curl::easy::CURLOPT_POSTFIELDS, join("", @data));

I changed that, but I saw no improvement.

> > How am I suppose to fill in this form, some text ?
> For details on how to script HTML forms with curl, check out the
> TheArtOfHttpScripting document.

Well, I do read this document from

Actually this doecument is the first I read about cURL and it made install
and try to use it to solve my problems. And yes, I am having progresses, I

But the problem is that the document we're talking about describes how to
use cURL from the command line.

"The form would look very similar to the previous one:

        <form method="POST" action="junk.cgi">
          <input type=text name="birthyear">
          <input type=submit name=press value="OK">

  And to use curl to post this form with the same data filled in as
before, we could do it like:

        curl -d "birthyear=1905&press=OK"

But how can I "translate" the above curl command line in a perl script
line ?

What about the below form ? What would be the appropriate perl/libcurl
approach ?

<form action="verify_send_messages.cgi?PartnerUsername=blue_eyed&Username=blue_eyed" id="DataEntryForm" method="post" name="DataEntryForm">
        <font face="Comic Sans MS" size="2">Send a Message to
        <textarea cols="48" name="Content" rows="8"></textarea><br>
        <input name="submit" type="submit" value="Send Message">

Thanks again !

"It's nice to be important, but it's more important to be nice !"
						SCOOTER <-- My personal web site (info about me&my life) <-- My resume/CV.
Received on 2001-11-08