For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > September 2006 > Send values in HTTP HEADER to a cgi script









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Send values in HTTP HEADER to a cgi script
tony

2006-09-14, 3:57 am

Good Day,

I need to a cgi script - I cannot change the destination script and I dont
know how to do this in PHP. I have messed around a bit with curl but dont
know if I am doing it right.

I have a copy of the CGI script that sends the values in the HTTP HEADER -
now I just need something in PHP that will do the same:

#!/usr/bin/perl
#use Crypt::SSLeay;
require LWP;
$id = 1234567891;
$acc=D701b67;
$addy = "http://www.domain.com/register.cgi";

$ua = new LWP::UserAgent;

my $header = HTTP::Headers->new('IDNUM'=>$id,'ACCNUM'=>$acc);
my $request = HTTP::Request->new('POST',"$addy",$header);

$request->content("$xml");
$response = $ua->request($request);
$reply_msg = $response->content;

print "Content-type: text/html\n\n";
print" <html>
$query = new CGI;
#print "$query->param('acc'); "\n;
print "||$addy||\n";
print "||$reply_msg||\n";


exit;


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com