RE: [PHP] Posting variables to a cgi without a form
| From: | Joseph Blythe | Date: | Mon, 05 Nov 2001 06:09:26 +0000 |
| Subject: | RE: [PHP] Posting variables to a cgi without a form | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-73449@lists.php.net to get a copy of this message | ||
Future ref:
$host = "www.somehost.com";
$port = "80";
$path = "/cgi-bin/somecgi.cgi?VAR1=$VAR1&VAR2=$VAR2&VAR3=$VAR3";
$fp = fsockopen($host, $port, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br>\n";
} else {
$request="GET $path HTTP/1.0\r\n\r\n";
fputs($fp, $request);
while(!feof($fp)) {
echo fgetss($fp, 128);
}
fclose($fp);
}
This seems to work, now to parse all the text so it looks pretty again
(doh!) :)
Regards,
Joseph
-----Original Message-----
From: Joseph Blythe [mailto:joe.blythe@binarylogic.com.au]
Sent: Monday, 5 November 2001 4:15 PM
To: Jason G.
Cc: php-general@lists.php.net
Subject: RE: [PHP] Posting variables to a cgi without a form
Thanks,
I got to recompile php to do this (me too lazy), can't I do this with the
network/filesystem functions? will keep this in mind though.
Regards,
Joseph
-----Original Message-----
From: Jason G. [mailto:blair@nb.net]
Sent: Monday, 5 November 2001 4:14 PM
To: Joseph Blythe
Subject: Re: [PHP] Posting variables to a cgi without a form
I believe cURL is great at this. Php supports cURL. go to curl.haxx.se
-Jason Garber
IoNZoft.com
At 03:40 PM 11/5/2001 +1030, you wrote:
>Hey all,
>
>What is the best wat to post some variables to a cgi file and capture the
>output so I may strip out all the html tags, I want to replace a forms
>action with a php script which will mimic a forms post method, allowing me
>to better format the response, as at the moment the cgi is written in c and
>creates a whole html page which i need to strip back down to text before I
>can include it in my site.
>
>I know about the string and filesysytem functions, sort of looking for a
>quick example of passing the variables to the cgi and capturing the output.
>
>Any help much appreciated,
>
>
>Regards,
>
>
>Joseph
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net