Quick PHP proxy
The Internet is loaded with tons of great open/free APIs you can use and many are fairly easy to setup. But if you're consuming them with JavaScript, you run into issues with cross-domain security policies, so they won't be consumed at all. You can bypass this by using something like JSONP, which gets around this limitation using a callback variable at the end of the request. However, not all APIs support callback with JSONP, such as the Foursquare API so you have to do something different like a proxy.
The idea behind a proxy is to use a server side language (in this case, PHP) to consume the API before it sends the info to the browser there by bypassing the cross-domain issues. There are tons of proxy scripts out there, but as per usual I like to roll my own stuff whenever I can, and I knew this one wouldn't be to crazy. As a matter of fact, I got it down to a single line of PHP. You can copy and paste the following code, then save it as "proxy.php".
The script is pretty straight forward, it simply spits out the return value of whatever it gets from the request parameter you pass in. In the case we were talking about earlier, you would create the URL to access the API for Foursquare, escape it (JS for url encoding) and then request the proxy page while passing in the API URL. It might look something like this using JQuery:
$.getJSON('proxy.php?request=' + escape(request) , function(data) {});
And that should do it. But be warned, this proxy has zero security applied to it, so someone could use it to access all sorts of things on your server if you're not careful. You can add different kinds of security on top of it though, like making sure the proxy is only being accessed from your domain or forcing it to only make requests to specific APIs else where. I just wanted to keep it open to show it as a quick starting point.