Need help getting a webpage!

const int inPin = D4;
http_request_t request;
http_response_t response;

void setup() {
pinMode(inPin, INPUT);

void loop() {
request.hostname = “”;
request.port = 80;
request.path = “/onalertguardian/auto2.html”;
if (inPin == HIGH)
http.get(hostname, path);

I want to do something like this. All the code I’ve looked at doesn’t work. I can’t update the libraries to accept new arguments. SO … it seems I’m stuck. I tried #include application.h but some of the included libraries in the application.h aren’t accepted. How do I call a webpage. What is the easiest way to get a webpage to call. The link
works fine. I can call it from a C# application in a PC but I’m trying to get rid of the PC all together and use this spark core for the same purpose. I’m STUCK! HELP!

Hi @Anthony

When I do a HTTP GET on that page, I get a form with lots of hidden fields that then wants you to do a POST to

Have you tried figuring out the parameters and doing a POST to that address?

A good way to see what happens is to use a logging proxy server like After you set up the proxy, you just surf the page and you can see all the requests.

You might be able to figure out all the parameters with curl and then you will know how to pass them with the Spark core.
I forgot that Chrome can paste as curl, so here is a sample POST that happened when I went there in Chrome:

curl '' -H 'Origin:' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Referer:' -H 'Connection: keep-alive' --data 'action=admin_menu&adminpass=onalert' --compressed

The important thing here is action=admin_menu&adminpass=onalert and maybe the referer header.


+1 to Charles Proxy. It’s super handy for when the Chrome JavaScript console/developer tools don’t quite cut it.

1 Like

Thanks for the reply but I’m trying to get the page to send from the spark core which activates the webpage which sends me a sample text. I’ve set up my server to have a group from a database that has phone numbers that will receive a text message when an event occurs. Currently I use a program that I wrote in C# in a PC. I want to do away with the PC and use the spark core to reduce my costs. I also have done it with Raspberry Pi using Scratch as well but that too is way too big. Any ideas?

Stop hitting the server. You are sending out text messages to my group!

Hi @Anthony

I don’t think you are seeing that doing one HTTP GET request from the core to that URL is not sufficient. You need to a HTTP POST with parameters above as well.

When I do a HTTP GET request on that URL, I get a hidden form that needs POST method to continue on the to final page.  All of that happens automatically in a browser.

In a web browser, lots of magic page forwarding and other automation can happen, but with the Spark core, you have to do that all yourself. If you can figure out how to do it with a tool like curl, which does not automatically handle all the magic a web browser does, then you can get it work with the Spark core.

Chrome’s developer tools can help, too. The Network tab is especially handy. If the web page you’re trying to use has any sort of redirect magic, you can check the “Preserve log” box at the top, and it won’t clear things out after the redirect.

1 Like