views:

51

answers:

1

The content of the an HTML file generated by a PHP is stored in a string variable called

$output

I am trying to send the contents in $output to a CGI script.

I have tried the following CURL in PHP...

$output = "long string, with strange non HTML characters..."
$c = curl_init();
curl_setopt($c, CURLOPT_URL, 'http://www.example.com/cgi-bin/script.cgi');
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, $output);
curl_exec ($c);
curl_close ($c);

...but I only get a small part of the $output content.

Do you have any recommendations on how to pass the content of $output from PHP to the CGI/Perl script?

Thanks!

A: 

I don't know if it suits you but you can do that:

curl_setopt($c, CURLOPT_POSTFIELDS, array("output" => $output));

This will sent your data as value of the POST field named 'output'

You may also use socket functions to open connection to server and send your own fully custom http request.

Kamil Szot
Works like a perfectly!Thanks!
ischnura