A Taylor <[EMAIL PROTECTED]> asked:
> I am trying to set some HTTP header variables in a perl 
> script that I can then pick up in another script.
> I want to create a situation as if some one had POSTed 
> variables from a form. I then want to pick these variables up 
> in an .asp script.

You can use LWP to make a POST request to another CGI script:

#!/usr/bin/perl -w

use strict;
use LWP::UserAgent;


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

  # set up a UserAgent object to handle our request
  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 {
    die $response->status_line;
  }
}


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

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

print post_url( $url, \%param );

__END__

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