I am trying to post a form data using the curl library but no matter what I do it does not pass the data to the receiving page.
Here is my code:
Code: Select all
$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_STDERR, $curl_log);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,0); //set to false as safe_mode = off
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_USERAGENT ,"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20071204 Firefox/2.0.0.3");
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_TIMEOUT, 200);
$header[] = "Content-Type: text/xml";
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$new_result = curl_exec($ch);
$curl_error = curl_error($ch);
$curl_errno = curl_errno($ch);
$curl_info = curl_getinfo($ch);
curl_close($ch);
echo $new_result;