Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Text
- Imports System.Net
- Imports System.IO
- Public Class HTTP_Handle
- Public Shared Function HTTP_DOWNLOAD_DATA(ByVal Site As String)
- Dim request As HttpWebRequest = DirectCast(WebRequest.Create(Site), HttpWebRequest)
- request.CookieContainer = FrmMain.Cookie_Handler
- Dim response As HttpWebResponse = DirectCast(request.GetResponse(), HttpWebResponse)
- Dim reader As New StreamReader(response.GetResponseStream())
- Return reader.ReadToEnd
- End Function
- Public Shared Function HTTP_POST_DATA(ByVal Site As String, ByVal POST As String, ByVal UserAgent As String)
- Dim postData As String = POST
- Dim tempCookies As New CookieContainer
- Dim _Encryption As New UTF8Encoding
- Dim byteData As Byte() = _Encryption.GetBytes(postData)
- Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create(Site), HttpWebRequest)
- postReq.Method = "POST"
- If FrmMain.Proxy_Enabled = True Then
- postReq.Proxy = New WebProxy(FrmMain.Proxy_IP, True)
- End If
- postReq.KeepAlive = True
- postReq.CookieContainer = FrmMain.Cookie_Handler
- postReq.ContentType = "application/x-www-form-urlencoded"
- postReq.Referer = Site
- postReq.UserAgent = UserAgent
- postReq.ContentLength = byteData.Length
- postReq.AllowAutoRedirect = False
- Dim postreqstream As Stream = postReq.GetRequestStream()
- postreqstream.Write(byteData, 0, byteData.Length)
- postreqstream.Close()
- Dim postresponse As HttpWebResponse
- postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
- tempCookies.Add(postresponse.Cookies)
- FrmMain.Cookie_Handler = tempCookies
- Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
- Return (postreqreader.ReadToEnd)
- End Function
- End Class
Advertisement
Add Comment
Please, Sign In to add comment