Hi

        I read a article about posting data .. and there was a script but I dont
know resource of this script. But this is working. let me give you a example

<?php


// Posting function

function PostToHost($host, $path, $data_to_send) {

 $fp = fsockopen($host,80);
 fputs($fp, "POST $path HTTP/1.1\n");
 fputs($fp, "Host: $host\n");
 fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
 fputs($fp, "Content-length: ".strlen($data_to_send)."\n");
 fputs($fp, "Connection: close\n\n");
 fputs($fp, $data_to_send);

while(!feof($fp)) {
echo fgets($fp, 128);
}

fclose($fp);

}

$host = "cgiserver.x.com";                      // target server
$path = "/cgi-bin/target.cgi";          // cgi's name
$string = "value1=value1&value2=value2" ; // There can be more value

PostToHost("$host","$patha","$string");         // call the function



?>

-----Original Message-----
From: Montgomery-Recht, Evan [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 19, 2001 2:06 PM
To: [EMAIL PROTECTED]
Subject: [PHP] HTTP POST Question


Good morning...

This should be a good monday morning question.

I have a cgi-bin written in perl (it's actually, a interface to a
perl-module which is a interface to a telnet-like protocol).

Anyways what I need to do is I have already existing code written in PHP,
but at some point I need to call this cgi-bin and get a return code from it
and process (good/bad result) and return to completed php script that says
it called this cgi-bin.  It's not very clear how to set the HTTP_POST_VARS
for sending to a post command (which doesn't seem to exist);

Any ideas I don't see a function called:

$HTTP_POST_VARS =set variables;
$result = http_post("http://localhost/cgi-bin/script.pl");

Thanks,

evan

PS.  I'd appricate a working example, even if it's a dummy version.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to