develooper Front page | perl.libwww | Postings from September 2001

Getting with HTTP 405 using HTTP::Form

Thread Next
From:
steve borruso
Date:
September 7, 2001 12:49
Subject:
Getting with HTTP 405 using HTTP::Form
Message ID:
000401c137d3$98b04300$6501a8c0@stny.rr.com
Greetings,

Having a problem submitting the last in a string of
4 consecutive forms (that I've managed to get my code to wade through).

Getting a 405 when I click on this last form ....
(..."This code is given with the Allow header and indicates that the method
used by the client is not supported for this URI.... ")

Not sure how to fix this since I assumed that the POST method is being
used by me just "clicking" the form that was previously served to me.

I noticed the "robots" reference in the returned header. Not sure if that
has
anything to do with the error.

Included code, output from a $form-> dump below along with the
resulting HTML error page.

Any assistance is appreciated.

Thanks,
Steve

Here's the code I'm using to modify a textarea then click submit ....

@alter_forms = HTML::Form->parse($alter_page_html,'http://cgi5.ebay.com');

   $alter_name = 'desc';
   $input_alter = $alter_forms[1]->find_input($alter_name);
   $input_alter -> value($AlterDesc);    # Paste info into textarea
   print $alter_forms[1]->dump  ;

   for my $alter_sub ($alter_forms[1]->inputs) {   # get last submit button
(better ways)
      next unless $alter_sub ->type eq 'submit';
      $keep_alter_sub = $alter_sub;
   }

   my $req5 = $keep_alter_sub->click($alter_forms[1]);

   my $uri5 = new $HTTP::URI_CLASS($req5->uri);
   $req5->uri($uri5);
   my $r5  = $ua->simple_request($req5);

   while ($r5->is_redirect) {
     my $u5 = $r5->header('location') or die "missing location: ",
$r5->as_string;
     print "redirecting to $u5\n";
     $r5 = $ua->simple_request(GET $u5);
   }
 my $review_html = $r5->content;

Output from the form dump .....

HTML/TokeParser.pm line 114.
POST http://cgi5.ebay.com/eBayISAPI.dll
  MfcISAPICommand=PreviewAddToItem  (hidden)
  userid=someuser              (hidden)
  pass=klajsdkjhasdkhasd.  (hidden)
  itemno=1238329721          (hidden)
  desc=<!-- text I added to textarea  (textarea)
  addcounter=<UNDEF>       (checkbox) [*<UNDEF>|on]
  counterstyle=-1                 (option)  [*-1|0|1|2|3]
  <NONAME>=review           (submit)
  <NONAME>=<UNDEF>     (reset)


Resulting html returned ......

<html><head><title>Error 405</title>
<meta name="robots" content="noindex">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=iso-8859-1"></head>
<body>
<h2>HTTP Error 405</h2>
<p><strong>405 Method Not Allowed</strong></p>
<p>The method specified in the Request Line is not allowed for the resource
iden
tified by the request. Please ensure that you have the proper MIME type set
up f
or the resource you are requesting.</p>
<p>Please contact the server's administrator if this problem persists.</p>


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