Actually what I need to do is submit data to a cgi script. The data must be as if it came from a form. So far I have figured that part out.
However now I have a new problem:
<?php
$c = curl_init('myurl_and_cgi_to_post_to');
$body = "This is my test and in it I need to use ampersands. & or &";
curl_setopt($c, CURLOPT_HEADER, 1);
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS, 'name=test&body=' . $body);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$page = curl_exec($c);
curl_close($c);
?>
The code above works but it confuses the ampersands in my $body variable text with the ampersands in the CURLOPT_POSTFIELDS. I need to be able to use the ampersands in my text. How do I work around this?
Thanks much,
Jeff