develooper Front page | perl.libwww | Postings from June 2003

Need help...

Thread Next
From:
Alan Olegario
Date:
June 12, 2003 07:53
Subject:
Need help...
Message ID:
204AB30D250D5945B495E9BC153366FB64E204@NYCLUSTER01.fxall.com
Hello.

I am extremely new to LWP, and I need some help.  I've been looking around and haven't found any useful examples of doing POSTs to sites.  Here's my code:

--------------------------
#!/usr/local/bin/perl
use LWP::UserAgent;
$ua = LWP::UserAgent->new;

my $req = HTTP::Request->new(POST => 'https://www.somesite.com');
$req->content_type('application/x-www-form-urlencoded');
$req->content('class=inputbox&name=USER&size=10&AUTOCOMPLETE=OFF&value=someuser');
$req->content('class=inputbox&type=PASSWORD&name=PASSWORD&size=10&AUTOCOMPLETE=OFF&value=somepass');

my $res = $ua->request($req);
print $res->as_string;
--------------------------
And here's my output:
==========================
HTTP/1.1 405 Method Not Allowed
Connection: close
Date: Thu, 12 Jun 2003 13:52:29 GMT
Server: Netscape-Enterprise/4.1
Allow: HEAD, GET, PUT, POST, DELETE, TRACE, OPTIONS, MOVE, INDEX, MKDIR, RMDIR
Content-Length: 124
Content-Type: text/html
Client-Date: Thu, 12 Jun 2003 13:52:30 GMT
Client-Peer: 216.74.155.198:443
Client-SSL-Cert-Issuer: /O=VeriSign Trust Network/OU=VeriSign, Inc./OU=VeriSign International Server CA - Class 3/OU=www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign
Client-SSL-Cert-Subject: /C=US/ST=New York/L=New York/O=Somecompany/OU=Infrastructure/OU=Terms of use at www.verisign.com/rpa (c)00/CN=www.somesite.com
Client-SSL-Cipher: EDH-RSA-DES-CBC3-SHA
Client-SSL-Warning: Peer certificate not verified
Title: Method Not Allowed

<HTML><HEAD><TITLE>Method Not Allowed</TITLE></HEAD>
<BODY><H1>Method Not Allowed</H1>
An error has occurred.
</BODY></HTML>

Thanks in advance for the help.


DISCLAIMER:
This message is intended for the named addressee(s) only and contains information that may be confidential, non-public or legally privileged.  If you are not the intended recipient, you must not copy this message or attachment or disclose the contents to any other person.  If you received this email in error, please contact the sender and permanently delete the email and any attachments. Unless expressly stated, opinions in this email are those of the individual sender and not of FX Alliance, LLC or its affiliates.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About