cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: finally

From: Nick Chirca <terra_at_vl.ro>
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
http://curl.haxx.se/docs/httpscripting.shtml

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
think...

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">
        </form>

  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" www.hotmail.com/when/junk.cgi
"

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
blue_eyed</font><br>
        <textarea cols="48" name="Content" rows="8"></textarea><br>
        <input name="submit" type="submit" value="Send Message">
              </form>

Thanks again !

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