handling xenforo javascript error for curl response

Jarvis

Member
I'm running a POST curl after a user submits a form, however the response I get from the request gives me a java error that displays on the page as:

The following error occurred
The server responded with an error. The error message is in the JavaScript console.

How can I have the xenforo JS just ignore the response and now throw me an error?

For reference, here is my PHP code:


PHP:
        $ch  = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url );
        curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
        curl_setopt($ch,CURLOPT_FOLLOWLOCATION, false);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($ch, CURLOPT_USERAGENT,'My App');
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
        $response = curl_exec($ch);
        curl_close($ch);
 
Top Bottom