Computing.Net > Forums > Web Development > Weather information on site

Weather information on site

Reply to Message Icon

Original Message
Name: ian_ok
Date: July 4, 2005 at 10:15:13 Pacific
Subject: Weather information on site
OS: win xp 98 & 2k
CPU/Ram: p3 512
Comment:

I'm after finding out how to get a live data feed of weather on my website for a certain town or place.

Also it's not going to be any bigger than 103x50 pixels.

Thanks for any tips websites etc...

ian

Venta Sanlucar Sales


Report Offensive Message For Removal


Response Number 1
Name: anonproxy
Date: July 4, 2005 at 18:12:52 Pacific
Reply: (edit)

Weather.com has an XML feed. An excellent example of this uses openrico. Of course, you can format the data as you please.


Report Offensive Follow Up For Removal

Response Number 2
Name: ian_ok
Date: July 4, 2005 at 23:26:17 Pacific
Reply: (edit)

One other small problem I'm after the Weather being for BULGARIA.

Ian


Venta Sanlucar Sales


Report Offensive Follow Up For Removal

Response Number 3
Name: Bob (by BigBob)
Date: July 6, 2005 at 18:40:03 Pacific
Reply: (edit)

Try http://www.wunderground.com


" You're only as safe as your last update "


Report Offensive Follow Up For Removal

Response Number 4
Name: twodaend
Date: July 7, 2005 at 15:07:44 Pacific
Reply: (edit)

anonproxy:

Do you know how to use the weather section on your own page. I can't get it to work, but would like to. It looks really great.
http://openrico.org/demos.page?demo=ricoWeather.html

Thanks


Report Offensive Follow Up For Removal

Response Number 5
Name: anonproxy
Date: July 7, 2005 at 17:29:36 Pacific
Reply: (edit)

Last I checked, XMLHTTPRequest only works within one domain. So a page retrieved from one domain can only make requests to that domain. An html document (and corresponding javascript) retrieved from a local file cannot communicate with anything but the localhost. Neither can a page from, say your website, communicate with openrico.org.

I just downloaded and toyed with the example. Everything worked fine except for the data transfer. The example requires some server-side functionality to work.

Notice this function in the html:

function registerAjaxStuff() {
ajaxEngine.registerRequest( 'getWeatherInfo', 'getWeatherInfoHTML.do' );
//some other stuff here I deleted
//registers HTML and javascript containers

//this here is our GET variable
$('zip').onkeydown = handleEnterKey.bindAsEventListener($('zip'));

}

getWeatherInfoHTML.do is a file requested, through code in rico.js, to a server handler (they are using a Java servlet). This is typically how you would implement a service (i.e. dynamically).

I haven't looked at the rico code, but I can tell getWeatherInfoHTML.do is just a url, because using it as such calls a revealing error. We need arguments to call the URL, else it returns nothing useful. Notice in the code above the zip variable? That's the argument we need to call. Try it out.

So, to get the example to work, we need only modify the URL handling for ajaxEngine.sendRequest(). This is done in ajaxEngine.registerRequest(). Things would work fine, but we still have to cross-domain limitation.

The PDF documentation is helpful. I should have read that first ;).


Report Offensive Follow Up For Removal


Response Number 6
Name: twodaend
Date: July 7, 2005 at 20:15:32 Pacific
Reply: (edit)

How do I modify the URL handling for the ajaxEngine.sendRequest(). I can get the page to show the input box and put in a zip, put nothign shows after that. It is not showing the weather for the zip I put in, just a blank area where the input field and button used to be. I don't know anything about javascript so this is all new to me.


Report Offensive Follow Up For Removal

Response Number 7
Name: anonproxy
Date: July 8, 2005 at 13:09:40 Pacific
Reply: (edit)

I don't think you understand how the library or XMLHTTPRequest works. I answered your question above. But you will still run into a snag, even if you change the request URL.

"...XMLHTTPRequest only works within one domain.". See my previous posts for why.

"The example requires some server-side functionality to work." Again, see the previous post. Finally, read the openrico.org documentation to see how the library works. You have all the code in front of you except for the Java request handler.



Report Offensive Follow Up For Removal






Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Weather information on site

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge