I have a main server with the main php "portal" script.
On an others server, there is a perl CGI, that I'm not allowed to run on the main server.
Now I'd like to let the main php script run the perl script on that other server. It would receive the POST/GET parameters and would pass them (though a user-agent) to the perl script and also dispay the output to the user.
In the perl script I would just have to change the path to itself, but I don't know how to do the user-agent stuff in php, or if there is a simpler way to this. Anyone got an idea?
Running a script from an other server through php
Moderator: General Moderators
thanx, it works!
the only strange thing is that while (!feof) didn't work, just keept waiting for something after the file was finished. so I had to insert my own EOF marker.
AND WHATS WORSE:
I get random "1000" strings in the text I receive!!!!!
Code: Select all
function tor() {
$PARAM=array_merge($_GET,_POST);
foreach ($PARAM as $key => $value) {
if ($key) {$p="$p&$key=$value";}
}
$p=preg_replace("/^\&/","?",$p);
$fp = fsockopen ("host.whereit.is", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br>\n";
} else {
fputs ($fp, "GET /cgi-bin/tor.cgi$p HTTP/1.1\nHost: host.whereit.is\r\n\r\n");
while (!$off) {
$b=fgets ($fp,128);
if (preg_match("/bodystart/i",$b)) {$on=1;}
if ($on) {print $b;}
if (preg_match("/bodyende/i",$b)) {$off=1;$on=0;}
}
fclose ($fp);
}
}AND WHATS WORSE:
I get random "1000" strings in the text I receive!!!!!