Cross-origin JSON request with jQuery and proxy.php

proxy.php

<?php

    $url = "http://external-site.com/service.php?action=list";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec ($ch);
    curl_close ($ch);
    echo $result;

?>

Open Demo in new Window

Related Links