I am trying to send simple entries in a form using PHP cURL so a remote server that the entries go to receives them in exactly the same manner as if sent from a plain and ordinary form. So far, the remote server accepts post directly from the form but not when sent by this PHP attempt. fopen and fsockopen etc. are set to "off" by the host (Yahoo) that I use, so cURL seems to be the best alternative.
As far as I can tell, no matter how the remote server is set up, if an ordinary post transmission is duplicated in its entirety, the server should accept the entries using cURL if it accepts the posted entries directly from the form.
$useragent = 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:220.127.116.11) Gecko/20100722 Ant.com Toolbar 2.0.1 Firefox/3.6.8 ( .NET CLR 3.5.30729) AutoPager/0.6.1.22';
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
The remote server will not accept the entries using this code.
From Firebug - Response Headers when form entries are posted:
Date: Tue, 17 Aug 2010 22:36:34 GMT
Server: Apache/2.2.8 (Fedora)
From Firebug - Request Headers when form entries are posted:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:18.104.22.168) Gecko/20100722 Ant.com Toolbar 2.0.1 Firefox/3.6.8 ( .NET CLR 3.5.30729) AutoPager/0.6.1.22
What can be done to make the entries be received the same as if sent by the form?
FORM action="http://remote_server.cgi" method="POST"