Hi guys,
Pretty simple and short but definitely useful for some members struggling with HttpWebRequests (GET & POST request).
I created a simple class to make HttpWebRequests easier, it has the capabilities to perform GET and POST request and return the source.
It takes cares of the cookies so it can be used for logins.
Source: http://pastebin.com/ZVmjseGg
Usage:
Note:
I coded this in like half an hour so I can still contain bugs, I did my best and if you find anything do not hesitate to notice me, I'll improve the code than.
Thanks.
Pretty simple and short but definitely useful for some members struggling with HttpWebRequests (GET & POST request).
I created a simple class to make HttpWebRequests easier, it has the capabilities to perform GET and POST request and return the source.
It takes cares of the cookies so it can be used for logins.
Source: http://pastebin.com/ZVmjseGg
Usage:
Code
' Create new instance of EasyHttp
Dim easyhttp As New EasyHttp()
' Do a GET request and get the source of it in a string
If (easyhttp.HttpGet("http://www.google.com")) Then
' GET request successful
Dim source As String = easyhttp.GetSource()
Else
MessageBox.Show("GET Request failed, error: " & easyhttp.GetError())
End If
' Do a POST request to some uri
If (easyhttp.HttpPost("http://www.example.com", "username=admin&password=SecretPassword12345)) Then
' POST request successful
Dim source As String = easyhttp.GetSource()
Else
MessageBox.Show("POST Request failed, error: " & easyhttp.GetError())
End IfNote:
I coded this in like half an hour so I can still contain bugs, I did my best and if you find anything do not hesitate to notice me, I'll improve the code than.
Thanks.




![[Image: 1zL3pDG.jpg]](https://i.imgur.com/1zL3pDG.jpg)