This answer has helped me largely but hasn\'t fully resolved my issues. I\'m using code similar to that, which is:
function getResponse() {
var the_url = \"
You need a page on your server that the JavaScript points at, which has the curl command in it. You can't just run cURL directly as a url like that.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $the_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, $_SERVER['REQUEST_URI']);
$result = curl_exec($ch);
curl_close($ch);
echo $result;