Passing POST request to another server
Posted: Fri Nov 26, 2004 12:21 pm
I now have a php script that works as a gateway to a perl script, passing the requests from the user though to the other server.
The code looks like this:
This works fine for GET request (passing short variables), but with POST request that contain things like data from a big textarea or an image, I always get this error:
It say "warning", but it's actually an error, because it doesn't work like this. Of course the same operation (updating text entry to DB) works, when I do it directly to the target tor.cgi on the other server.
How could I make this work, even with such long arguments (or images)?
The code looks like this:
Code: Select all
foreach ($_REQUEST as $key => $value) {if ($key) {$p="$p&$key=$value";}}
$p=preg_replace("/^\&/","?",$p);
$html=implode('',file("http:/server.domain.ch/cgi-bin/tor.cgi$p"));
print "$html";Code: Select all
Warning: file("http://server.domain.ch/cgi-bin/tor.cgi?login=xxx&pw=xxxx&title=Das Höhere Lehramt&subtitle=&eid=91&value=Das höhere Lehramt (HLA) ist die Ausbildung, die absolviert
(..............much more text....)
in /du1v2/users/sub/www/index.php on line 3
Warning: Bad arguments to implode() in /du1v2/users/sub/www/index.php on line 65How could I make this work, even with such long arguments (or images)?