CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
Simulating a POST action



Mar 24, 2000, 5:20 PM

Post #1 of 2 (756 views)
Simulating a POST action Can't Post

Hi and many thanks in advance to one and all Smile

What I would like to do is have a program which parses the HTML of a webpage, the webpage being retrieved using LWP::Simple and the get command.

However, if the webpage being retrieved was generated by a CGI script given certain query data, how can I pass data to the script if it requires the POST action to be used? Smile

Obviously for a GET action I would include the data in the URL I requested, eg:

use LWP::Simple;


But how can I run the script using the POST action rather than GET? Smile

Thanks all Smile


Mar 24, 2000, 5:38 PM

Post #2 of 2 (756 views)
Re: Simulating a POST action [In reply to] Can't Post

You can't use LWP::Simple for this. You'll need LWP::UserAgent. Example:

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

use LWP::UserAgent;

$client = new LWP::UserAgent;
$req = new HTTP::Request POST => "", [ name => "jeff", age => 18 ];
$return = $client->request($req);

Read the lwpcook documentation that comes with the LWP suite of modules.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives