I have a curl code to past POST data. This code is working if the form is submited to PHP file. But if the code is submited to ASP file, it isn't working. It is as if ASP file does not recognize my POST data. The code I use is simple CURL code: try { $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_VERBOSE, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible"); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $response = curl_exec($ch); echo $response; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; }
Have you tried posting the data via an ajax call and seeing if that works? If it works for the php file, sounds to me like the problem is with the asp handling it ...
You might need to add a referral option: curl_setopt($ch,CURLOPT_REFERER, $url); PHP: Also you can always check the error by doing: $errorMessage = curl_errno($ch); $errorNumber = curl_error($ch); PHP: