1
Network / Re: HTML setHost
« on: August 19, 2018, 04:33:42 am »The next obvious step would be to Google "HTTP status code 301" and understand what it does and what it means and then you can handle it.
Alright I got everything working lol, is there way to get a specific part of the html?
I tried messing around with setField and setBody. They dont seem to work. I know that getBody returns one big string, and one way I know is to read the string and get data from it. Is there a better way or should i just continue with my way?
The optimal method of retrieving such data is by sending a request to a REST API and then using a JSON parser to access the data.
For example:
Quote
https://samples.openweathermap.org/data/2.5/weather?lat=35&lon=139&appid=b6907d289e10d714a6e88b30761fae22
Returns:
Quote
{"coord":{"lon":139.01,"lat":35.02},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"base":"stations","main":{"temp":285.514,"pressure":1013.75,"humidity":100,"temp_min":285.514,"temp_max":285.514,"sea_level":1023.22,"grnd_level":1013.75},"wind":{"speed":5.52,"deg":311},"clouds":{"all":0},"dt":1485792967,"sys":{"message":0.0025,"country":"JP","sunrise":1485726240,"sunset":1485763863},"id":1907296,"name":"Tawarano","cod":200}
API Documentation:
https://openweathermap.org/current
JSON Parser (header library):
https://github.com/nlohmann/json