Solved

Automating Form Submission

Posted on 2000-03-30
2
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…
Six Sigma Control Plans

615 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