sdestudio
sdestudio

Reputation: 25

How to get page by URL in NodeMCU (ESP8266)

I want to get value in NodeMCU module from my own page, hosted by free hosting. Final URL is: boiler.atwebpages.com/boi.php. First, i perform connect to server: client.connect(boiler.atwebpages.com, 80)

and send request

client.println("GET /boi.php HTTP/1.0");
client.println()

And here's the problem. First microchip get IP from boiler.atwebpages.com (which is 83.125.22.211) and try to get file boi.php. In fact, it try to access into 83.125.22.211/boi.php, which doesn't exist, so i get 404 error. Is that possible to get information from direct URL or get direct path from IP address?

Upvotes: 1

Views: 2012

Answers (1)

Mark McGinty
Mark McGinty

Reputation: 756

You need to send the Host header with the request:

client.println("GET /boi.php HTTP/1.0\r\nHost: boiler.atwebpages.com\r\n");

Upvotes: 1

Related Questions