Hello,
I'm wondering if anyone has come across any libraries in javascript that can emulate something like php's cURL?
Hello,
I'm wondering if anyone has come across any libraries in javascript that can emulate something like php's cURL?
XMLHttpRequest can fetch resources on the same domain/server. If you need something externally just use XHR/Ajax to a server-side page that fetches the external data and outputs it so your XHR can grab it.
Client-side JavaScript running in a browser only has access to XMLHttpRequest, which are just HTTP requests. cURL does much more than just HTTP, with a whole lot more control, including cross-domain requests. The things JavaScript can do are really quite limited.
Not possible as the browser sandbox doesn't allow you to make TCP sockets directly. You're limited to the options given by XmlHTttpRequest. You'd need a server-side proxy script to do what you want. Or use flash/java which gives you more options regarding connectivity. Still restricted to the same domain I believe though.