• Log in or sign up for an account here: https://www.sythe.org/login

HTTP Wrapper for VB.Net?

Bman :)

Member
Joined
Jul 8, 2009
Sythe Gold
0
Messages
51
I was wondering if there was a httpwrapper for VB.net, because if there is, I May start programming in VB.net again :)
 
Member of the Month Winner
Sythe's 10th Anniversary
Please elaborate on what you mean by HttpWrapper. I do find .Net perfectly capable of HTTP interoperability, so there is probably something along those lines even though I don't know what you're talking about.

Take a look around the System.Net namespace on MSDN.
 
In visual basic 6, there was a module and user control in which let you post data and use certain functions of a webbrowser without having the actual webbrowser present.

It is useful for making programs that you do not want to use alot of RAM and/or hard drive.

It saves alot of time then going through the webbrowser functions and posting data that way, when you could just do something like this :

strHTML = wrapper.postwrapper("http://www.google.ca/search?hl=en&q", text1.text & "&btnG=Google+Search&meta=&aq=f&oq=")


That function would just go to google.ca, and post the data that was in textbox 1 to the search box on google.
 
<3 n4n0
Discord Verified
Two Factor Authentication User
Community Participant
Spam Forum Participant
Sythe's 10th Anniversary
Sythe Awards 2011 Winner
You could always write your own. The hardest part would be handling cookies...
 
something like this;
(the cookie container isn't necessary in this case since google doesn't uses cookies for a simple search.. but you will need it if you have to authenticate e.g log somewhere... )

Imports System.Net
Imports System.IO

Module Module1


Sub Main()
Dim someKeyword As String = Console.ReadLine()
Dim req As HttpWebRequest = HttpWebRequest.Create("http://www.google.com/search?hl=en&q=" + someKeyword)
Dim cookieC As CookieContainer = New CookieContainer()
req.CookieContainer = cookieC
Dim resp As WebResponse = req.GetResponse()
Dim respStream As Stream = resp.GetResponseStream()
Dim reader As StreamReader = New StreamReader(respStream)
Dim source As String = reader.ReadToEnd()

Console.Write(source)
Console.ReadKey()
End Sub

End Module
pretty ugly but you get the idea and don't forget to close the streams etc when you are done...
 
<3 n4n0
Discord Verified
Two Factor Authentication User
Community Participant
Spam Forum Participant
Sythe's 10th Anniversary
Sythe Awards 2011 Winner
Google does use cookies for a simple search... D:
 
oh really? never checked but w/e my mistake :p


EDIT: I checked, and they maybe use cookies but they aren't necessary.. so you don't need the cookie container for a google search..
 
Member of the Month Winner
Sythe's 10th Anniversary
You could always write your own. The hardest part would be handling cookies...
Handling cookies is actually EXTREMELY easy.

Use the HttpWebRequest (inherits from WebRequest) and HttpWebResponse (inherits from WebResponse) classes. You can then use what are called cookie containers. Basically you create and set the container, and all cookies will be stored in that container. You can then use that container to set the cookies for the next request, etc.

Edit: Just so you know, HttpWebRequest and HttpWebResponse are the proper way you should send or receive information to/from the internet - WebClient is too basic and you can't really do much with it. WebRequest and WebResponse use data streams to/from the server, and they have full support for most (if not all) features of the Hyper-Text Transfer Protocol.
 
<3 n4n0
Discord Verified
Two Factor Authentication User
Community Participant
Spam Forum Participant
Sythe's 10th Anniversary
Sythe Awards 2011 Winner
Handling cookies from scratch is a bitch.... lol... Even from semi-scratch... >_>... And thats why I want to do it. Cuz its a bitch. lol.
 
<3 n4n0
Discord Verified
Two Factor Authentication User
Community Participant
Spam Forum Participant
Sythe's 10th Anniversary
Sythe Awards 2011 Winner
Runescape Gamblingrunescape gambling
Back
Top