Advertisement
Guest User

User Counter [VB.NET]

a guest
May 12th, 2015
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.03 KB | None | 0 0
  1. Private Sub checkOnline(ByVal inEsecuzione As Boolean)
  2.         Dim s As HttpWebRequest
  3.         Dim enc As UTF8Encoding
  4.         Dim postdata As String
  5.         Dim postdatabytes As Byte()
  6.         Try
  7.             s = HttpWebRequest.Create("http://www.tuosito.com/check.php")
  8.             enc = New System.Text.UTF8Encoding()
  9.  
  10.             If inEsecuzione Then
  11.                 postdata = "start=1"
  12.             Else
  13.                 postdata = "start=0"
  14.  
  15.                 postdatabytes = enc.GetBytes(postdata)
  16.                 s.Method = "POST"
  17.                 s.ContentType = "application/x-www-form-urlencoded"
  18.                 s.ContentLength = postdatabytes.Length
  19.  
  20.                 Using stream = s.GetRequestStream()
  21.                     stream.Write(postdatabytes, 0, postdatabytes.Length)
  22.                 End Using
  23.                 Dim result = s.GetResponse()
  24.             End If
  25.         Catch Ex As Exception
  26.             MessageBox.Show(Ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
  27.         End Try
  28.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement