Posting Variables From Script?
Posted: Thu Oct 10, 2002 6:52 pm
Hi everyone,
I am trying to use a php script to send variables using POST to another script and I am having trouble. This is what I have so far but it does not work, there is no error message it just loads a blank html page.
<?php
$data = "variable=123";
$url = 'www.mysite.com';
$sock = fsockopen($url, 80);
set_socket_blocking($sock, 1);
$path = '/cgi-bin/gateway.cgi';
$request="HEAD $path HTTP/1.0\r\n";
$request.="HOST: $host\r\n";
$request.="$data";
$request.="\r\n";
fputs($sock, $request);
$out = "";
$out = fgets($sock,32000);
echo "$out";
?>
Any help would be great!
I am trying to use a php script to send variables using POST to another script and I am having trouble. This is what I have so far but it does not work, there is no error message it just loads a blank html page.
<?php
$data = "variable=123";
$url = 'www.mysite.com';
$sock = fsockopen($url, 80);
set_socket_blocking($sock, 1);
$path = '/cgi-bin/gateway.cgi';
$request="HEAD $path HTTP/1.0\r\n";
$request.="HOST: $host\r\n";
$request.="$data";
$request.="\r\n";
fputs($sock, $request);
$out = "";
$out = fgets($sock,32000);
echo "$out";
?>
Any help would be great!