To run php scripts located on this site, you will need to put a "proxy script" on your site, where you host your pages. Otherwise web browsers will complain about security violations.
Firefox will fail quietly, but IE will say:
"To help protect your security, Internet Explorer has restricted this file from showing active content that coule access your computer. Click here for options..."
We have chosen to modify #4. See code and comments below.
Here is a collection of proxy scripts collected over time with where they came from. If you decide to modify them to make them work for this site, please send us a copy so we can post them for everyone.
1 | Came from here. Here is a ASP Proxy Script. |
2 | Came from here. PHP Script using cURL. Aside from PHP, you will need to install CURL if you don't have it already on your server to run it. <?php // Get the url of to be proxied //Start the Curl session // If it's a POST, put the POST data in the body // Don't return HTTP headers. Do return the contents of the call curl_setopt($session, CURLOPT_FOLLOWLOCATION, true); // Make the call if ($mimeType != "") echo $response; curl_close($session); ?> Usage:-http://yourserver.com/proxy.php?url=<url_encoded_desitnation_url>[&mimeType=<mimeType>] Examples:-To load XML/Text:
|
3 | From here: From this, there's a way to build PHP5, curl-less proxy: <?php (12:09)Chad: Instead of this: |
4 | Here's a good one from the Yahoo folkes. A simple web proxy, written in PHP Here's a version that WORKS. Modified code is right here. Cut and paste it into a callzip.php and put it on your server in the same folder as the page that makes the lookup calls. If this doesn't work, see if you need to install CURL library for your PHP, if you don't have it already. <?php //define ('HOSTNAME', 'http://search.yahooapis.com/'); // Get the REST call path from the AJAX application // Open the Curl session // If it's a POST, put the POST data in the body // Don't return HTTP headers. Do return the contents of the call // Make the call // The web service returns XML. Set the Content-Type appropriately echo $xml; ?> |
5 | Google guys wrote one too. Similar to 4. |