Importing data from web site

M

Martin Parker

Hi

Is there any procedure with VB to mimic something like the 'get external
data from web' function within Excel.

I would like to import currency exchange rate data from a web site and show
the results in a listview control.

Any help on this would be very much appreciated.

TIA
 
N

Nathan Sokalski

That depends on the website you want to import from. You can obviously read
the response sent from a URL, which could obviously be whatever the server
sends it as (html, plain text, graphic, file, or even just a series of
bits). If there is a URL that will return the data you want, or something
containing the data you want that you could parse, you can do that. Or, if
you have access to the same database or source that the website got their
stuff from, you could do that instead (that might not make it exactly "from
web", but it would be over the internet, and the web is nothing but a
specific part of the internet anyway). So it's not really a question of
whether VB.NET has any way to do it, but whether there is anywhere to get
the data from.
 
M

Mohammed Sirajuddin

Hi Nathan Sokalski,

Im new to vb.net application and Im looking for a code which can import some data from website on my vb.net form (if possible in textbox).

Actually Im looking to download content from the below url

http://configure.us.dell.com/dellst...n&s=dhs&cs=19&model_id=inspiron-15r-combo-mod

When you open the page, you will see "Dell Price $549.99" on right side of the page. Im looking to import Price in my textbox.

In the below post you said its possible. Could you please help me with it.

Thanks in advance,

Regards,
Sirajuddin
 
M

Mohammed Sirajuddin

Hi Nathan Sokalski,

Im new to vb.net application and Im looking for a code which can import some data from website on my vb.net form (if possible in textbox).

Actually Im looking to download content from the below url

http://configure.us.dell.com/dellst...n&s=dhs&cs=19&model_id=inspiron-15r-combo-mod

When you open the page, you will see "Dell Price $549.99" on right side of the page. Im looking to import Price in my textbox.

In the below post you said its possible. Could you please help me with it.

Thanks in advance,

Regards,
Sirajuddin
 
N

Nathan Sokalski

That is a question that you would need to ask the webmaster at Dell, because retrieving a specific piece of information from a page is not something that can be easily done without direct access to the source (which I'm assuming is a database on their server). You will need to find out if they have a URL that takes a querystring and returns only the value(s) you need or want, or something like that. The only real option you have without contacting them is to use what is called "ScreenScraping", which is basically retrieving from a site what you would see if you did a View Source in your browser. Here is the basic code:

Dim source As New System.Net.WebClient()
Dim utf8 As New System.Text.UTF8Encoding()
Dim result As String = utf8.GetString(source.DownloadData(Me.txtSourcePath.Text))

(NOTE: Me.txtSourcePath is a Textbox on the Page I used this code on, this is where you would put the URL of the page you want to get)

The problem with using this technique for your scenario is that you would need to parse the entire page, which could be very long, very hard to parse, and could easily change if Dell made any changes to it, so I strongly suggest that you not use this for your scenario. I think all you can do is contact them and ask if there is a way they can give you the information you want.

Submitted via EggHeadCafe
ASP.NET In-Memory Image Control with Built-In Resizing of Posted File
http://www.eggheadcafe.com/tutorial...rol-with-builtin-resizing-of-posted-file.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top