Ok, a few people have asked about sending data to a website like a browser (simulating the <form> in html pages)
here's an example form on a website
so the fields you need to send are "D1", "term" and probably not needed for this site but for HTML standards sake also "search" (the button pressed)Code:<form method="post" action="http://themis.**********.com/cgi-bin/search.cgi"> <select name="D1" size="1"> <option value="subject">Article Content</option> <option value="name">Author name</option> <option value="eseek">Web Search</option> </select> <input type="text" name="term" size="12"> <input name="search" type="image" src="images/go.gif" alt="Search Now!" align="middle" border="0"> </form>
NOTE: when value is set in the <option> tag within <select> tag this is what you send.
we send a fieldname/value object where we set these fields, the response will be in byte form, we need to convert it to ASCII to read it
this example sends the search "test" to the webpage and returns the results in HTMLCode:Dim wc As New Net.WebClient 'the webclient Dim bt() As Byte 'the returned bytes Dim html As String 'the returned HTML text 'setup fields to be sent Dim fields As New Specialized.NameValueCollection fields.Add("D1", "subject") 'search option fields.Add("term", "test") 'search box fields.Add("search", "") 'button pressed bt = wc.UploadValues("http://themis.**********.com/cgi-bin/search.cgi", fields) 'send fields and retrieve response html = System.Text.Encoding.ASCII.GetString(bt) 'convert to text MsgBox(html)




Multi-Clipboard
Reply With Quote