What is wrong with this cURL post in PHP versus a straight HTML post? -


the following html form posts remote, external server success, more secure curl post php script fails. don't receive error information via script, , remote party has not been able furnish any, question boils down to, critical difference between 2 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 it!" /> </form> 

and 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 protect guilty.

try logic, facilitate debugging of curl requests. main curlopt_returntransfer , curl_getinfo.

$ch = curl_init(); ...  curl_setopt($ch, curlopt_returntransfer, 1);  $result = curl_exec($ch); $info = curl_getinfo($ch);  if ($result === false || $info['http_code'] != 200) {     // error } else {     // ok } 

Comments