HTTP/1.1 302 Moved Temporarily response to a GET

I'm trying to get data from a weather webiste (www.metoffice.gov.uk) but I keep getting 302 responses. The location for the redirect is the same as the original GET.

Is this just a mechanism to stop web scraping or am I doing something incorrectly?

My GET command is:

GET /public/weather/forecast/gbyrvp258 HTTP/1.1
Host: www.metoffice.gov.uk
Connection: close

And the response is:

HTTP/1.1 302 Moved Temporarily

Server: AkamaiGHost

Content-Length: 0

Location: https://www.metoffice.gov.uk/public/weather/forecast/gbyrvp258

Cache-Control: max-age=0

Expires: Sun, 01 Oct 2017 10:28:52 GMT

Date: Sun, 01 Oct 2017 10:28:52 GMT

Connection: close

The server wants you to use HTTPS instead of HTTP.

Pieter

PieterP: The server wants you to use HTTPS instead of HTTP.

Pieter

Ha! Thanks! Obvious isn't it!

Unfortunately I think ESP8266 WifiClientSecure may not work... but that's another story!

Many thanks!

richardtheboffin: Unfortunately I think ESP8266 WifiClientSecure may not work... but that's another story!

What makes you think that? It works just fine.

Here's an example: https://tttapa.github.io/ESP8266/Chap17%20-%20Email%20Notifier.html

Pieter

PieterP: What makes you think that? It works just fine.

Here's an example: https://tttapa.github.io/ESP8266/Chap17%20-%20Email%20Notifier.html

Pieter

I was reading a very thread about support for it and TLS?, but I am just updating my libraries, so hopefully, I will be able to report back some success!

Well it is working! Thanks for your help there Pieter.

One more question.

In the loop parsing the response to the GET, I have seen while(client.connected()) and while(client.available())

Are these doing effectively the same thing?