Hi, 

Johann Tagle <[EMAIL PROTECTED]>
> I have a script that receives certain data from an html form, 
> processes them, then submits the processed data to another 
> script.  Problem is, I want it to do so without having to 
> click anything anymore.
[...]
> Any ideas?

Have a look at LWP and in particular LWP::UserAgent - you could
use the post() method to submit your parameters to the other
CGI program. As an added bonus, you can examine the result of
the operation and report success or failure to your users.

#!/usr/bin/perl -w

use strict;
use LWP::UserAgent;

sub post_url {
  my( $url, $formref )  = @_;

  my $ua = new LWP::UserAgent(timeout => 300);

  $ua->agent('perlproc/1.0');

  my $response = $ua->post($url, $formref );
  
  if( $response->is_success ){
    return $response->content;
  } else {
    return undef;
  }
}


my $url = "http://localhost/cgi-bin/listcgiparam.cgi";;

my %param = ( 'foo' => 'bar', 'email' => '[EMAIL PROTECTED]' );

print post_url( $url, \%param );

HTH,
Thomas

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to