Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As mmattax mentioned, the easiest way to do this is by using a proxy script.</p> <p>Here's a script I use to call out to another domain, passing it an urlencoded proxy_url parameter.</p> <p>url_proxy.php <pre><code>// Is it a POST or a GET? $url = ($_POST['proxy_url']) ? $_POST['proxy_url'] : $_GET['proxy_url']; // Open the Curl session $session = curl_init($url); // If it's a POST, put the POST data in the body if ($_POST['proxy_url']) { $postvars = ''; while ($element = current($_POST)) { if (key($_POST) != 'proxy_url') { $postvars .= key($_POST).'='.$element.'&amp;'; } next($_POST); } curl_setopt ($session, CURLOPT_POST, true); curl_setopt ($session, CURLOPT_POSTFIELDS, $postvars); } // Don't return HTTP headers. Do return the contents of the call curl_setopt($session, CURLOPT_HEADER, false); curl_setopt($session, CURLOPT_RETURNTRANSFER, true); // Make the call $response = curl_exec($session); // Return the response if (curl_errno($session)) { $error_message = curl_error($session); echo 'Error: '.$error_message; } else { echo $response; } curl_close($session); ?&gt; </code></pre> <p>In your case you may want to alter the error handling bit to return a valid bit of xml that your app can parse.</p> <p>I usually put this in my webroot, and call it from javascript with something like:</p> <pre><code>function showMapLegend(baseURL, layer) { var url = 'http://our-map-server/get-a-legend.php?layer='+layer; var dt = new Date(); var proxy = baseURL + '/url_proxy.php?currDate='+dt.getTime()+'&amp;proxy_url='; url = proxy + encodeURIComponent(url); new Ajax.Request(url, { method: 'get', onSuccess: function(transport) { $('map-legend-img').src = transport.responseText; new Effect.Appear('map-legend', {duration: 0.5}); } }); } </code></pre> <p>The example javascript function above is used to get a simple url string back from our map server, we don't care if it fails so there's no onFailure etc, and it's mostly Prototype, but I'm sure you get the idea on how this uses the proxy script.</p> <p>The baseURL variable is passed in, it should contain the base "<a href="http://server/theappname" rel="nofollow noreferrer">http://server/theappname</a>" like url for your app.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload