Build a sample CURL - Node.js - HTML page (No PHP)
$10-30 USD
Imekamilika
Imechapishwa over 6 years ago
$10-30 USD
Kulipwa wakati wa kufikishwa
I'm working with a US Government website API system and the examples that they give are in CURL [login to view URL] I want to develop a web page where my users can put in a value such as Name and my web page will produce the results. This is a system for third party developers so it is 100% acceptable to get the data. At the bottom of the page are examples in both CURL and a request URL. I tried to use jQuery and Ajax to GET the URL but it throws errors so the next step is to use CURL which is server side. I have read the node.js works well with CURL so I'm open to use that also. I want a simple web page (No PHP) just a .html with a javascript example that fills a textarea with the returned response. Parsing the return value is a different project for a bit latter. I've added a file with a couple of CURL request that I would like to see run from the example that you produce. After you set this up on your system you need to tell me how to set this up on my system to run.
Hello,
You can use the reverse proxy on your server to call API directly using Jquery rather than writing script. By the way, if you still need to use NodeJS, I can write NodeJS script to call API but you must know NodeJS script cannot be run on the browser.
Let me know if you would like to discuss
Thanks
Hi,
You won't ever be able to make these kinds of requests with just a HTML page and some javascript.
Without being able to allow cross-site requests on the external API (which you can't do), then you will need some kind of proxy.
The absolute simplest way to do that is with PHP and curl. You can set it up in Node.js as well, but then you would have to set up a node.js server on your host. That's not less complicated than using PHP and Apache - it's actually way more complicated.
The best thing to do is to just write a simple PHP file that takes your request and passes it onto the API (a proxy). Again you can do that with Node.js but pretty much any host you use will have PHP and Apache on it - it won't have Node.js by default.
Thanks
John
hello sir,
i read your post, want to ask few question about this
i have more than 7 yeras of experience in this
inbox me so we can discuss better about this
thank you