Hej,
For at hente info fra en hjemmeside kan du bruge:
- Public Class Form1
-
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
- Dim webclient As New System.Net.WebClient
- Dim ip As String
- ip = System.Text.Encoding.ASCII.GetString(( _ webclient.DownloadData("http://whatismyip.com/automation/n09230945.asp")))
- Label1.Text = ip
-
- End Sub
-
- End Class
Og for at poste til en webside f.eks. youtube login kan du bruge denne kode:
- Public Class Form1
-
-
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- WebBrowser1.Navigate("https://accounts.google.com/ServiceLogin?uilel=3&service=youtube&passive=true&continue=http%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue?%26nomobiletemp%3D1%26hl%3Den_GB%26next%3D%252Findex%253Fhl%253Den-GB&hl=en_GB<mpl=sso")
- End Sub
-
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- WebBrowser1.Document.GetElementById("Email").SetAttribute("value", TextBox1.Text)
- WebBrowser1.Document.GetElementById("Passwd").SetAttribute("value", TextBox2.Text)
- WebBrowser1.Document.GetElementById("signIn").InvokeMember("click")
- End Sub
-
-
- End Class
Håber dette var svar på dit spørgsmål og til at forstå ellers er du velkommen til at skrive
Mvh. Malte
Indlæg senest redigeret d. 05.10.2011 21:43 af Bruger #16751