Cross Domain JavaScript With Simple PHP Proxy

Simple PHP Proxy is a small PHP script that allows your JavaScript to access HTML, XML or JSON data in remote web pages. It overcomes the cross-domain security limitations, even if data is not available in JSONP format.

By using Simple PHP Proxy, your server can act as an intermediary between your JavaScript and the remote data, removing any cross-domain issues from the equation. It just needs to take a request, forward it to a remote server, and return the results. You can use any JavaScript library with it or code your XMLHttpRequest objects by hand.

Features

  • Requested URLs can be white-listed and validated against a regex
  • Optionally forward client cookies / SID to the remote server
  • Optionally forward configurable User Agent to the remote server
  • Requests can use either GET or POST request methods
  • Remote data can be delivered as-is with all remote headers intact (disabled by default to limit XSS vulnerabilities)
  • Remote data can be wrapped in a JSON/P structure that includes status codes and remote headers (JSONP disabled by default to limit abuse)
  • If using JSON/P and remote data is valid JSON, it will be merged into the resulting data object

Developed by Ben Alman; Simple PHP Proxy is available for download under GPL and MIT License.  You can find further information, demo & download on Simple PHP Proxy Website.

Stay Updated

If you found this post useful, consider subscribing to our RSS Feed! You can also stay updated by following us on Twitter and Facebook or by subscribing to our FriendFeed.

Bookmark / Share

Bookmark and Share

Read More

SIMILAR/RELATED POSTS:

PREVIOUS POST:

NEXT POST:

Reader Comments

One Response to “Cross Domain JavaScript With Simple PHP Proxy”
  1. Thanks alot, I’ve been looking for a way to do this! It allways bugs me that JavaScript won’t do cross domain!

Leave Comment

 
 

Stay Updated, Subscribe to RSS Feed

 
 
 
 

Blogroll

 

Sponsored Links