The following HTML form posts to remote, external server with success, but my slightly more secure cURL post from a PHP script fails. I don’t receive any error information via my script, and the remote party has not been able to furnish any, so my question actually boils down to, what the critical difference between the two post requests is.
The winner:
<form name="frm" action="http://wow.aspx" method="post">
<input type="HIDDEN" name="q1" value="charlesmanson">
<input type="HIDDEN" name="q2" value="batman@home.net">
<input type="HIDDEN" name="q3" value="20110428092741">
<input type="HIDDEN" name="q4" value="6E1AAB44-7508-4BF4-ADA8-0535E880A996">
<input type="submit" value="Go for it!" />
</form>
And the loser:
$curlSession = curl_init('http://nowbitch.aspx');
curl_setopt ($curlSession, CURLOPT_POST, 1);
curl_setopt ($curlSession, CURLOPT_POSTFIELDS, "q1=$userLogin&q2=$userRecord[email]&q3=$timeStamp&q4=$hash");
curl_setopt ($curlSession, CURLOPT_FOLLOWLOCATION, 1);
curl_exec ($curlSession);
curl_close ($curlSession);
Real parameters have been lost to protect the guilty.
Try this logic, it facilitate the debugging of curl requests. The main is to
CURLOPT_RETURNTRANSFERandcurl_getinfo.