Go Down

Topic: Extract data from weather service? (Read 711 times) previous topic - next topic

Arne

Hi all,

I need help in understanding how to extract the data from a weather service. Is using the GET command the way to go?

Copied from recent post:
Code: [Select]
client.println("GET /search?q=http://weather.yahooapis.com/forecastrss?w=4118&u=c HTTP/1.0");

Any help or tips most welcomed.
Arne

PaulS

What does the rest of your code look like?

What output do you get when you make that request?

Arne

This started from another topic (see link> http://arduino.cc/forum/index.php/topic,91667.msg688439.html#msg688439

I'm not that far along yet.

I was using some example code for the Ethernet shield in order to get an understanding of the GET command. Member (dhunt) pointed me to a free weather service when I made a comment that that was where I was headed.

Small steps at this time, otherwise I will be totally lost.

However, I will try and see what happens.
Arne

PaulS

Quote
Small steps at this time, otherwise I will be totally lost.

Absolutely the best way to go. Make a change. See what effect that has. Make another change, See what you screwed up this time.

Presumably, though, the sketch you are modifying already does a get and prints the data sent back by the server. I would think that changing the GET command would be an easy change to make and test. But, take your time, and understand what you are doing. There's no rush. We'll be here.




Are you done yet?

Arne

Thanks Paul,

Not quite (working night shift this week, brain a little fussy) :smiley-sleep:

Has anybody use the GET command that can post some examples or links?

Anyone?

Arne

#5
Feb 14, 2012, 02:08 am Last Edit: Feb 14, 2012, 02:39 am by Arne Reason: 1
Okay here it is:

Note: the code used to get this output is from zoomkat that I modified:
Better client test 12/01/11
Send an e in serial monitor to test
connected
HTTP/1.0 404 Not Found
Date: Tue, 14 Feb 2012 00:55:01 GMT
P3P: policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAOO...shortened...LOC GOV"
Cache-Control: private
Vary: Accept-Encoding
Content-Type: text/html; charset=utf-8
Age: 0
Server: YTS/1.20.0

<html>
<head>
<meta http-equiv="refresh" content="10;url=/">
   <title>Yahoo!</title>
</head>

<body>
etc, etc....


I feel like I just jumped into the middle of a forest

But, I got something  :~

PaulS

Quote
But, I got something

Not really. You got an error message.
Quote
HTTP/1.0 404 Not Found


You'll need to pay attention to the changing URL in the address bar as you enter data or whatever when you go to http://developer.yahoo.com/weather/ to determine what the GET command should look like. The search$q= part clearly doesn't belong in the GET command.

Arne

Quote
Not really. You got an error message.

Okay, that helps.

I took out the search stuff.
Still came back with "404 not found" but why connected?
Maybe... connected because server 209.191.122.70 is there but not the info/file... is that close?
Do you know of any simple examples.

zoomkat

The below might be of interest.

http://arduino.cc/forum/index.php/topic,80914.msg611082.html#msg611082
Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

Arne

Nice link Zoomkat, I will have to print that one off.
Thank You

I came across some other info that I will link here so that I don't lose it.
Code 200 OK http://www.w3.org/Protocols/HTTP/1.0/spec.html#Code200
and GET http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.3


PaulS

Quote
Maybe... connected because server 209.191.122.70 is there but not the info/file... is that close?

That's exactly what the message means. If the server was invalid, you'd get a different message, in the 500 range.

If the server was there, and the file existed, but you didn't have permission to read it, you'd get a different message (403).

Quote
Do you know of any simple examples.

For?

The weather site that you were directed to has directions on it for figuring out what values to append to the URL to get weather for your area. If you are having trouble forming the request, tell us what area you want weather for, and well help.

Webmeister


Go Up