-->
Page 1 of 1

Basic Post to Server

PostPosted: Sun Oct 16, 2016 6:11 pm
by Joshua Perk
Hi, all!

I've looked through the many included examples that come with Core and I'm fairly certain I'm over complicating things. My ESP8266 automatically connects to my WiFi without issue. Now, all I want it to do is send one command.

Background:

I have hosted a PHP script that when ran with an API key will change a field in a database from 0 to 1. It is structured like http://website.com/api/index.php?key=123456789

How can I tell my ESP8266 to "go" to that URL? I don't care about any return or receiving of data, I just want to run that script with the key.

Thank you!

Re: Basic Post to Server

PostPosted: Mon Oct 17, 2016 2:25 pm
by Joshua Perk
I want to reply to my own post with a link I found moments after submitting this topic. Adafruit did a really good job of writing a tutorial on this simple post here:https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout/using-arduino-ide.

In particular, here's the main snippet I was going for:

Code: Select all  // This will send the request to the server
  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" +
               "Connection: close\r\n\r\n");