Izgleda de cu trebati da koristim php -q preko CGI (tj. prvo pitam host koja je putanja do PHP)
<?php
$postdata = "var1=332&var2=16";
$fp = fsockopen("localhost", 80, $errno, $errstr, 30);
if (!$fp)
{
echo "$errstr ($errno)<br />\n";
}
else
{
$out = "POST /debug.php HTTP/1.0\r\n";
$out .= "Host: localhost\r\n";
$out .= "Content-Type: application/x-www-form-urlencoded\r\n";
$out .= "Content-Length: ".strlen($postdata)."\r\n";
$out .= "\r\n$postdata\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp))
{
echo fgets($fp, 128);
}
fclose($fp);
}
?>
i debug.php
<?php
header ("Content-Type: text/html");
echo "<STRONG>".$_POST["var1"]."</STRONG>";
echo "<BR><STRONG>".$_POST["var2"]."</STRONG>";
?>
i izlaz (u browseru)
Citat:
HTTP/1.1 200 OK Date: Wed, 04 Jan 2006 09:04:20 GMT Server: Apache/1.3.33 (Win32) PHP/5.0.4 X-Powered-By: PHP/5.0.4 Connection: close Content-Type: text/html 332
16
|
a isto dobijam i na serveru. Hederi su dvaput poslati, sem ako nema neko od vas resenje.
joj isto mu dodje i sa php -q