473,394 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to retrive HTML Content from a given URL with VB 2008

cardei
5
Hi, I try to retrieve html content from a web page with VB .net

I used this code (console app) that I find on internet :

Expand|Select|Wrap|Line Numbers
  1.  
  2. Imports System
  3. Imports System.Net
  4. Imports System.IO
  5. Module Module1
  6.  
  7.   Sub Main()
  8.         Dim sURL As String
  9.         sURL = "http://www.checkmytrip.com"
  10.  
  11.         Dim wrGETURL As WebRequest
  12.         wrGETURL = WebRequest.Create(sURL)
  13.  
  14.         Dim myProxy As New WebProxy("myproxy", 80)
  15.         myProxy.BypassProxyOnLocal = True
  16.  
  17.         'wrGETURL.Proxy = myProxy
  18.         wrGETURL.Proxy = WebProxy.GetDefaultProxy()
  19.  
  20.         Dim objStream As Stream
  21.         objStream = wrGETURL.GetResponse.GetResponseStream()
  22.  
  23.         Dim objReader As New StreamReader(objStream)
  24.         Dim sLine As String = ""
  25.         Dim i As Integer = 0
  26.  
  27.         Do While Not sLine Is Nothing
  28.             i += 1
  29.             sLine = objReader.ReadLine
  30.             If Not sLine Is Nothing Then
  31.                 Console.WriteLine("{0}:{1}", i, sLine)
  32.             End If
  33.         Loop
  34.  
  35.         Console.ReadLine()
  36.  
  37.     End Sub
  38.  
  39. End Module
It's work fine in console mode but when I paste it in my app the app is crash or stop responding.

I replaplace the line 30,
Expand|Select|Wrap|Line Numbers
  1. Console.WriteLine("{0}:{1}", i, sLine)
with
Expand|Select|Wrap|Line Numbers
  1. textbox1.text = textbox1.text & sline
and I deleted the line 34.

I need to extract some data from a given URL to use it later in my app.

If somebody can help me??

Sory for my english! :)

Thanks.
Feb 29 '08 #1
0 736

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Mark Watkins | last post by:
Of course, this is not an html board, but some of you may be able to answer this question. Copy and past the html below into a text file so you can open it in IE and see what I mean: ...
1
by: TdarTdar | last post by:
Hello, what is the code to get the running applications "ApplicationId" Thanks Tdar
1
by: amritranjan | last post by:
How to retrive image file from MS access database and display this in another JSPpage -------------------------------------------------------------------------------- This is my Jsp code for...
14
by: asdf | last post by:
I have a python script whose output i want to dynamically display on a webpage which will be hosted using Apache. How do I do that? thanks
5
by: Juan R. =?iso-8859-1?q?Gonz=E1lez-=C1lvarez?= | last post by:
I want to substitute "\(" by "(" i have tried content = content.replace(/\\\(/g, "("); content = content.replace(/\\\(/g, unescape("%26") + "#40;"); content = content.replace(/\\\(/g,...
6
by: Guy Macon | last post by:
cwdjrxyz wrote: HTML 5 has solved the above probem. See the following web page: HTML 5, one vocabulary, two serializations http://www.w3.org/QA/2008/01/html5-is-html-and-xml.html
7
by: praveenb000 | last post by:
Hi, every one on this forum.... I am new to web designing (using HTML/CSS). i designed a web page using HTML, Css with dream weaver. Here is the code i used for the desinging. it appears well...
10
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
42
by: Santander | last post by:
how to decode HTML pages encoded like this: http://www.long2consulting.com/seeinaction2008/Simplicity_Beach_table/index.htm Is there script that will do this automatically and generate normal fully...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.