Solved

Automating Form Submission

Posted on 2000-03-30
2
198 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
ID: 2671438
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
ID: 2672301
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Syslog text file into database or into .CSV 19 109
perl CPAN issue 3 99
Regular Expression for URL 10 91
XML::LibXML and Xpath syntax How do I get attribute of sibling 2 116
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…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

920 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

15 Experts available now in Live!

Get 1:1 Help Now