I had recently been fooling around quite a bit with YQL, which does provide some built-in features to make cross-domain http requests. It can be done with the html open data table. You can try it out from the YQL Console. Just go to the data tables section on the right side and select Data > html. Unfortunately, the built-in html table is somewhat limited. You can only make requests using the GET method, and it does not provide any mechanism for sending/receiving HTTP headers.
I started developing my own custom open data table for the particular project I was working on at the time, and eventually the project morphed into xdRequest. Because I needed to track cookies and redirects in my little project, I realized that it would be great to develop a generic library that could handle such requests. Eventually, I more or less abandoned the previous project to develop xdRequest. Here are some of the features, as highlighted on the project page:
- Make cross-domain requests using the GET and POST methods
- Add request headers along with the requests
- Automatically collect cookies sent by the remote web server
- Automatically follow redirects and collect cookies along the way
- Properly store/transmit cookies, much like the popular server-side library, cURL
- Automatically submits hidden fields detected within forms on webpages
I also put together a relatively simple xdRequest demo. It brings in data from espn.go.com. When the page loads, it makes an xdRequest to ESPN for the University of Florida Football schedule. I’m a die-hard Gator and UF alumnus, so that’s why I decided to start the demo with the UF football schedule. When you can click the hyperlinks in the demo, xdRequests are made to ESPN to load schedules for other teams, as well as the box scores for games. It’s a simple example, but the sky is the limit as to what you can do with xdRequest.
If you like xdRequest and build any cool web applications with it, let me know and I’ll link to it from the project page. If you have any feature suggestions or encounter any bugs, please report them in the xdRequest issue tracker.