Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27512

VS 2010 HELP, get sourcedata from webpage

$
0
0
Hello guys,

I'm busy making a program which can get data from a website. Unfortunately I'm stuck now. I'm trying to get the sourcedata of the traininggraph-image (so not the sourcedata of the webpage). Please take a look a the picture underneath. As you can see there is a box where you can select a player. Even though I for example select player number 4 in the box, I still get the sourcedata of player one. What am I doing wrong? :ehh: You can find the sourcedata of the webpage in webpage.txt

Attachment 94595


Something goes wrong here. For the whole code see program.txt:

Dim allelements As HtmlElementCollection
allelements = WebBrowser1.Document.GetElementsByTagName("a")

WebBrowser1.Document.GetElementById("training_graph_select_player").SetAttribute("selectedindex", 22)
'GoTo einde


For Each curElement As HtmlElement In allelements
'WebBrowser1.Document.GetElementById("training_graph_select_player").SetAttribute("selectedindex", 2)
'If curElement.GetAttribute("training_graph_select_player").Contains("3. Bertus Lute") Then
'curElement.InvokeMember("click")
'End If
If curElement.GetAttribute("OuterHtml").Contains("All") Then
curElement.InvokeMember("click")

'While WebBrowser1.ReadyState <> WebBrowserReadyState.Complete
'Application.DoEvents()
'End While

Dim theElementCollection5 As HtmlElementCollection
theElementCollection5 = WebBrowser1.Document.GetElementsByTagName("div")
For Each curElement5 As HtmlElement In theElementCollection5

Dim controlName5 As String = curElement5.GetAttribute("id").ToString
Dim xxx1 As String

If controlName5 = "highcharts-container" Then
xxx1 = curElement5.InnerHtml.ToString()
Dim xxx2 As String = Replace(xxx1, Chr(34), "")
Dim xxx3 As String = Replace(xxx2, "<IMG style=POSITION: absolute; MARGIN-TOP: ", "*")

Dim aFile As String
aFile = "C:\Users\p.plomp\Desktop\mz-parser\trainingshistorie_" & spelerid3 & "_" & spelernaam3 & ".txt"
If Len(Dir$(aFile)) > 0 Then
Kill(aFile)
End If

Dim file5 As System.IO.StreamWriter
file5 = My.Computer.FileSystem.OpenTextFileWriter("C:\Users\p.plomp\Desktop\mz-parser\trainingshistorie_" & spelerid3 & "_" & spelernaam3 & ".txt", True)


Dim Fields3() As String
Dim blok1 As String
Dim blok2 As String
Dim blok3 As String
Dim blok4 As String
Dim str3 As String
Dim strArr3() As String
Dim count3 As Integer
Dim xxx4 As String = Replace(xxx3, "; TOP: ", "@")
Dim xxx5 As String = Replace(xxx4, "px; LEFT:", "@")
Dim xxx6 As String = Replace(xxx5, "trainingicon.php?icon=", "@")
Dim xxx7 As String = Replace(xxx6, "filled=true", "@")
str3 = xxx7
strArr3 = str3.Split("*")
For count3 = 0 To strArr3.Length - 1
xxx7 = (strArr3(count3))
If count3 > 0 Then
Fields3 = Split(xxx7, "@")
blok1 = Fields3(0)
blok2 = Fields3(1)
blok3 = Fields3(2)
blok4 = Fields3(3)
Dim xxx8 As String
xxx8 = blok2 & ";" & blok4
Dim xxx9 As String = Replace(xxx8, " width=20 height=52", "")
Dim xxx10 As String = Replace(xxx9, " width=11 height=20", "")
Dim xxx11 As String = Replace(xxx10, " stroked=false", "")
file5.WriteLine(xxx11)
xxx11 = ""
xxx1 = ""
End If
Next

file5.Close()
End If
Next

End If

Next

Next

End Sub

End Class
Attached Images
 
Attached Files

Viewing all articles
Browse latest Browse all 27512

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>