Advertisement
Brandan

Untitled

Oct 8th, 2014
504
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.52 KB | None | 0 0
  1.     public sub efkhwr
  2.     dim PITS_SRC = HTTP("http://www.wccca.com/PITSv2/Default.aspx", "POST", "__viewstate=")
  3.  
  4.     end sub
  5.  
  6.         Public Function HTTP(ByVal url As String, ByVal method As String, ByVal data As String)
  7.             Try
  8.  
  9.                 Dim request As System.Net.WebRequest = System.Net.WebRequest.Create(url)
  10.                 request.Method = method
  11.                 Dim postData = data
  12.                 Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
  13.                 request.ContentType = "application/x-www-form-urlencoded"
  14.                 request.ContentLength = byteArray.Length
  15.                 Dim dataStream As Stream = request.GetRequestStream()
  16.                 dataStream.Write(byteArray, 0, byteArray.Length)
  17.                 dataStream.Close()
  18.                 request.Timeout = 5000
  19.                 Dim response As WebResponse = request.GetResponse()
  20.                 dataStream = response.GetResponseStream()
  21.                 Dim reader As New StreamReader(dataStream)
  22.                 Dim responseFromServer As String = reader.ReadToEnd()
  23.                 reader.Close()
  24.                 dataStream.Close()
  25.                 response.Close()
  26.                 Return (responseFromServer)
  27.             Catch ex As Exception
  28.                 Dim error1 As String = ErrorToString()
  29.                 If error1 = "Invalid URI: The format of the URI could not be determined." Then
  30.  
  31.                 Else
  32.  
  33.                 End If
  34.                 Return ("ERROR")
  35.             End Try
  36.         End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement