Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Automating Form Submission

Posted on 2000-03-30
2
Medium Priority
?
230 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 200 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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.…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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

688 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