Results 1 to 9 of 9

Thread: Weather app and website information gatherer

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2012
    Posts
    51

    Red face Weather app and website information gatherer

    Hello everyone!!
    It's been a long, long time since I've been coding. But today I had a fun idea for a weather app but I need some help..

    I forgot the coding on how to get information from a website and put it to a text box in vb.net (2010).

    I'm very bad at the advanced coding but I know how to make the application fun and wondering if any of you could help me out a little! I heard http://api.accuweather.com/ has a simplistic weather page.

    You don't need to give me ALL the coding of course, just one to help me get the general idea

    If someone could give me some sample coding on lets just say the temperature, that would be great. I want the user to but their zipcode into a textbox, click enter a text box will put the temp. another textbox.

    Any help guys? It would be very very helpful.

  2. #2
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    756

    Re: Weather app and website information gatherer

    Hi,
    that API is subscriber only so unless someone here is subscribed to it we will not be able to help much.

    Grabbing data from a webpage can be done many ways, for example, you can read the source into a string and then search the string for what you need.

    If you let me know where you will get your data i can help more (if it is api.accuweather then some code or source would be needed).
    My CodeBank Submissions
    • Listbox with transparency and picture support - Click Here
    • Check for a true internet connection - Click Here
    • Open Cash drawer connected to receipt printer - Click Here
    • Custom color and size border around form - Click Here
    • Upload file to website without user logins, includes PHP - Click Here
    • List All Removable USB Storage Devices - Click Here
    • Custom On/Off Slide Control - Click Here
    • Insert multiple rows of data into one database table using parameters - Click Here
    • Trigger USB/Serial Cash Drawer - Click Here

  3. #3
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Weather app and website information gatherer

    If you live in the US NOAA has an XML version of the weather. If you click on these two links

    http://forecast.weather.gov/MapClick...0#.U0u4BFe2Wno

    http://forecast.weather.gov/MapClick...&FcstType=dwml

    You will see the relationship between the formatted and XML versions of the weather forecast.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  4. #4

    Thread Starter
    Member
    Join Date
    Sep 2012
    Posts
    51

    Re: Weather app and website information gatherer

    Quote Originally Posted by bensonsearch View Post
    Hi,
    that API is subscriber only so unless someone here is subscribed to it we will not be able to help much.

    Grabbing data from a webpage can be done many ways, for example, you can read the source into a string and then search the string for what you need.

    If you let me know where you will get your data i can help more (if it is api.accuweather then some code or source would be needed).
    I private messaged you!

  5. #5
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    756

    Re: Weather app and website information gatherer

    Quote Originally Posted by jj103 View Post
    I private messaged you!

    Please try and keep anything related to this thread public incase someone else who finds the thread looking for help can get it.

    As per your message you still haven't said which one you will go with or which points of data you are after.

    I will say that there is 2 ways I personally would go about this, the first is to download the source code as a string and then "search" the string for your info

    Code:
    Dim wc as New Webclient
    Dim mytext as String
    mytext = wc.DownloadString("http://www.myweather.com")
    
    'search mytext for what you wish
    The other way is very much the same but instead of searching for strings you assign the elements to a document and work with them

    Code:
    Dim wc as New Webclient
    Dim mytext as String
    
    mytext= wc.DownloadString("http://www.mysite")
    
    Dim wb as New Webbrowser
    wb.DocumentText = ""
    wb.Document.OpenNew(false)
    wb.Document.Write(mytext)
    
    'you need to look at the source to see where to go now, if we had an element with an ID of say 'temp' then
    
    Label1.Text = wb.Document.getElementById("temp").innerHTML
    My CodeBank Submissions
    • Listbox with transparency and picture support - Click Here
    • Check for a true internet connection - Click Here
    • Open Cash drawer connected to receipt printer - Click Here
    • Custom color and size border around form - Click Here
    • Upload file to website without user logins, includes PHP - Click Here
    • List All Removable USB Storage Devices - Click Here
    • Custom On/Off Slide Control - Click Here
    • Insert multiple rows of data into one database table using parameters - Click Here
    • Trigger USB/Serial Cash Drawer - Click Here

  6. #6

    Thread Starter
    Member
    Join Date
    Sep 2012
    Posts
    51

    Re: Weather app and website information gatherer

    Okay! Thank you very much, but I seem to not be able to find the "string"

    Sorry..very long time and I can't figure it out.

    Currently using "http://weather.yahooapis.com/forecastrss?w=2459115"
    How would I find the string or "element ID" for lets just the temperature.

    Again, thank you very much with the help.

    (Using the second code provided by you)

  7. #7
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    756

    Re: Weather app and website information gatherer

    You are dealing with an XML document in that case use the below

    Code:
     Dim wc As New WebClient
            Dim mytext As String
    
            mytext = wc.DownloadString("http://weather.yahooapis.com/forecastrss?w=2459115")
    
            Dim mt As New Xml.XmlDocument
            mt.LoadXml(mytext)
    
            Dim rr As Xml.XmlNodeList = mt.GetElementsByTagName("ttl")
    
            For Each ee As Xml.XmlElement In rr
                MsgBox(ee.InnerText)
            Next
    My CodeBank Submissions
    • Listbox with transparency and picture support - Click Here
    • Check for a true internet connection - Click Here
    • Open Cash drawer connected to receipt printer - Click Here
    • Custom color and size border around form - Click Here
    • Upload file to website without user logins, includes PHP - Click Here
    • List All Removable USB Storage Devices - Click Here
    • Custom On/Off Slide Control - Click Here
    • Insert multiple rows of data into one database table using parameters - Click Here
    • Trigger USB/Serial Cash Drawer - Click Here

  8. #8

    Thread Starter
    Member
    Join Date
    Sep 2012
    Posts
    51

    Re: Weather app and website information gatherer

    Alright! So far looking good but I think one more question!
    Temperature is found in the "ttl"
    But for the others, let's say the extended forecast, it has a lot of data per tag.
    Let's say I want a label to display Monday's high, and another label to display monday's low.

    I think that's the last thing I need to learn, to be able to separate different bits of data in one tag.
    Thank you!!

  9. #9
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    756

    Re: Weather app and website information gatherer

    instead of ee.innerText look at its other properties, you will find an answer
    My CodeBank Submissions
    • Listbox with transparency and picture support - Click Here
    • Check for a true internet connection - Click Here
    • Open Cash drawer connected to receipt printer - Click Here
    • Custom color and size border around form - Click Here
    • Upload file to website without user logins, includes PHP - Click Here
    • List All Removable USB Storage Devices - Click Here
    • Custom On/Off Slide Control - Click Here
    • Insert multiple rows of data into one database table using parameters - Click Here
    • Trigger USB/Serial Cash Drawer - Click Here

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width