TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Code Seven
NA
1
0
need help to get variables from web to program
May 30 2010 4:19 AM
can anyone help me with code for program who would take name, price and end time from for example http://www.aukcije.hr/item.php?id=768168, (for example name is USB memory stik 1GB novi, price Trenutna cijena : 60,00 kn and end time Aukcija završava za : 9 dana, 23h:27m:15s), i have maked code but it dosnt work like it should :S
Imports System.Net
Imports System.Data
Imports System.IO
Imports System.Text.RegularExpressions
Public Class Form1
Public Shared Function GetPageAsString(ByVal address As String) As String
Dim request As HttpWebRequest
Dim response As HttpWebResponse = Nothing
Dim reader As StreamReader
Dim result As String
Try
Try
' Create the web request
request = DirectCast(WebRequest.Create(address), HttpWebRequest)
' Get response
response = DirectCast(request.GetResponse(), HttpWebResponse)
' Get the response stream into a reader
reader = New StreamReader(response.GetResponseStream())
' Read the whole contents and return as a string
result = reader.ReadToEnd()
Finally
If Not response Is Nothing Then response.Close()
End Try
Catch ex As Exception
End Try
Return result
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox2.Text = GetPageAsString(TextBox1.Text) '<-url
Dim str1 As String = " <td height=""25"" valign=""top"" bgcolor=""#f3f3f3"">"
Dim str2 As String = "</td>"
' Declare iteration variable
Dim s As String
' Loop through words in string
Dim arr As String() = SplitWords(TextBox2.Text)
' Display each word. Note that punctuation is handled correctly.
For Each s In arr
Dim b As Integer = 0
Dim a As String = s
If a = "Trenutna" Then b += 1
If a = "kn</span>" Then b += 1
If b > 0 Then TextBox3.Text += a
If b = 2 Then GoTo bbb
Next
bbb:
End Sub
Private Function SplitWords(ByVal s As String) As String()
Return Regex.Split(s, "\W+")
End Function
End Class
Reply
Answers (
0
)
Basics of HTML
HP Certification HP2-T17 exam training