Solved

Automating Form Submission

Posted on 2000-03-30
2
185 Views
Last Modified: 2010-03-05
I used the following code as suggested in S20.2 of Perl Cookbook:

#!/usr/usc/bin/perl -w

use LWP::Simple;
use URI::URL;

my $url = url('http://164.195.100.11/netacgi/nph-Parser');
$url->query_form(TERM1 => 'alcatel',
             FIELD1 => 'ASNM',
             d => 'pt95');
unless (defined ($content = get $url)) {
    die "could not get $url\n";
}

print "$content\n";


I get back an error page:

Error #1003
<HTML>
<HEAD><TITLE>Error</TITLE></HEAD>
<BODY><H1>Error!</H1>
<HR>
<H4>BRS was unable to process your request.  A diagnostic message was mailed to the appropriate personel.</H4>
</BODY></HTML>


Where am I going wrong? By the way, this is supposed to retrieve a page from the US Patent & Trademark Office.


thanks,

ibyxtl
0
Comment
Question by:ibyxtl
2 Comments
 
LVL 25

Accepted Solution

by:
clockwatcher earned 50 total points
Comment Utility
You seem to be missing a bunch of hidden variables.  Try this:

use LWP::Simple;
use URI::URL;

my $url = url('http://164.195.100.11/netacgi/nph-Parser');

$url->query_form(


  Sect1 => 'PTO2',
  Sect2 => 'HITOFF',
  p => '1',
  u => '/netahtml/search-bool.html',
  r => '0',
  f => 'S',
  l => '50',
  TERM1 => 'alcatel',
  FIELD1 => 'ASNM',
  d => 'pt95'

);

print get $url;
0
 
LVL 10

Expert Comment

by:makerp
Comment Utility
try this. ive just tried it and it works

use LWP::Simple;

$content = get("http://bt754554/");
if($content)
{
     print $content;
}
else
{
   print "Problem";
}

0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now