Posting from cURL: HTTP_X_REQUESTED_WITH

I programmatically host a form for processing PHP script forms. Is there a way to get the script form handler to assume that the message is being executed by ajax? The form handler is currently checking HTTP_X_REQUESTED_WITH at $ _SERVER to implement ajax custom logic. I need these codes that are executed when submitting to the form using cURL.

+7
source share
2 answers

via PHP cURL - http://www.php.net/manual/en/function.curl-setopt.php

$ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-Requested-With: XMLHttpRequest")); $result = curl_exec ($ch); curl_close ($ch); 
+21
source
 curl -H "X-Requested-With: XMLHttpRequest" ... 

This sends the β€œX-Requested-With” header with your request. Then the value ("XMLHttpRequest") is available in $_SERVER['HTTP_X_REQESTED_WITH'] .

+10
source

All Articles