Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pulling data from web sites using XML

Status
Not open for further replies.

AsciiMom

Programmer
Joined
Oct 2, 2001
Messages
5
Location
US
I need to pull data from several web sites - i think using xml. Can anyone point me to a really simple example?
I don't know where to begin. Do I need to use WSDL?
If you can't tell, I am a newbie to VB.net.


Thanks All,
 
Here's a link to a thread on this site regarding reading XML:

thread796-704664

Look towards the bottom for the code examples.
____________________________________________
 
Thanks. I have read this thread before. However, it does not answer how one gets the xml file from another website. Er - I'm not certain that I am asking the right question.

What I'd like to do is pull published data from the web - I thought I could download xml files from the web sites.

Thanks for any assistance.
 
The code below will pull the HTML or XML from a web site. If the page is HTMl then you'll prolly need to use RegularExpressions to parse the data. If it's in XML then there are plenty of sites that show you how to navigate the document.

Please excuse me if I've misunderstood your request.

Public Function GetHtmlPageSource(ByVal url As String) As String
Dim st As System.IO.Stream
Dim sr As System.IO.StreamReader

Try
' make a Web request
Dim req As System.Net.WebRequest = System.Net.WebRequest.Create(url)
' if the username/password are specified, use these credentials

' get the response and read from the result stream
Dim resp As System.Net.WebResponse = req.GetResponse
st = resp.GetResponseStream
sr = New System.IO.StreamReader(st)
' read all the text in it
Return sr.ReadToEnd
Catch ex As Exception
Return Nothing
msgbox (ex.tostring)
Finally
' always close readers and streams
sr.Close()
st.Close()
sr = Nothing
st = Nothing
End Try
End Function

code obtained through....

Scott
Programmer Analyst
<{{><
 
Thanks stnkminky
That's the ticket. I appreciate your help. My next neophyte question is how do I find the xml file from the website?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top