[EMAIL PROTECTED] wrote:

> 
> I've been digging through the Net for sometime now trying to find out
> how the post an HTML form to a web server using LWP::UserAgent,
> HTTP::Request and HTML::Form.
> 
> I can download the form, parse it, and fill in the values that I need to
> with no problem. However, when I attempt the generate a Request object
> from the form, I get the error :
> 
> No request object passed in at C:\Temp\misbt\sample.pl line 24
> 
> I've pulled the form off the web server and reduced it as much as
> possible and put it on my test server. I've also reduced the code as
> much as possible. I'm still getting this error and I don't see what's
> wrong.
> 
> I'm at my Whit's End on this one and would appreciate any help available.  
> 
> I'm using:
> ActivePerl v5.6.1 built for MSWin32-x86-multi-thread, build 638.
> LWP::UserAgent version 2.024
> HTTP::Response version 1.41
> HTTP::Request version 1.34
> HTTP::Cookies version 1.36
> HTML::Form version 1.038
> 
>  Here's a sample script:
> 
> use strict;
> use LWP::UserAgent;
> use HTTP::Response;
> use HTTP::Request;
> use HTTP::Cookies;
> use HTML::Form;
> 
> my $ua = LWP::UserAgent->new('from' => '[EMAIL PROTECTED]',
>                              'agent' => $0);
> $ua->cookie_jar(HTTP::Cookies->new());
> 
> my $form = HTML::Form->parse(
>     $ua->request(
>         HTTP::Request->new(GET => 'https://pcme0022c/ttransmit.html')
>         )

Don't you need a base URL here as the second arg ?

>     );
> 
> $form->value("testType","Developer"); #or Transmitter
> $form->find_input("transmitFile")->file($ARGV[0]);
> print "\n\n\nDebug Form: ",$form->dump,"\n";
> 
> print "test transmission:\n\n",
>     $ua->request->(
>         $form->click("submit")
>         )->as_string(),"\n";
> 
> Here's the form:
> 
> <HTML><HEAD><TITLE>Sample form</TITLE>
> </HEAD>
> <BODY>
>      <FORM enctype="MULTIPART/FORM-DATA" name="frmTestTransmit"
> id="frmTestTransmit" action="processFile" method=post>
>       <P><INPUT type=file size=30 name="transmitFile"><br>
>       <font size="2" face="Arial"><input type="radio"
> value="Transmitter" id="testType1" name="testType"><label
> for="testType1" accesskey="T"><u>T</u>ransmitter
>       Test</label>&nbsp; <input type="radio" value="Developer"
> id="testType2" name="testType"><label for="testType2"
> accesskey="D"><u>D</u>eveloper
>       Test</LABEL></font></P>
>       <P>
>         <input type="hidden" name="txtSite" value="test">
>         <INPUT type=submit value="Transmit" name=submit></P>
>       </FORM>
> </BODY>
> </HTML>
> 
> Here's the sample output:
> 
> Debug Form: POST https://pcme0022c/processFile (multipart/form-data)
> [frmTestTransmit]
>   transmitFile=sample.xml          (file)
>   testType=Developer              (radio)   [Transmitter/Transmitter
> Testá|*Developer/Developer Test]
>   txtSite=test                    (hidden)
>   submit=Transmit                 (submit)
> 
> No request object passed in at C:\Temp\misbt\sample.pl line 24

-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)


_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to