Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module Module1
- Sub Main()
- Dim user As String
- Dim bot As String
- Do
- user = Console.ReadLine()
- If botresponse(bot) = "" And InStr(bot, "<html") = 0 Then
- Console.WriteLine("|" & bot & "|" & user & "|")
- bot = PostHTTPWebrequest("http://78.47.186.254/simple.php", "entry=" & bot & "&exit=" & user)
- End If
- Do Until bot <> "" Or user = ""
- bot = botresponse(user)
- user = Mid(user, 1, Len(user) - 1)
- Loop
- If bot = "" Then
- Console.WriteLine("I don't know")
- ElseIf InStr(bot, "today is") Then
- Console.WriteLine("It's " & Day(Now) & " of " & MonthName(Month(Now)) & " today.")
- Else
- Console.WriteLine(bot)
- End If
- bot = ""
- Loop
- End Sub
- Public Function PostHTTPWebrequest(ByVal URL As String, ByVal PostData As String) As String
- Dim encoding As New System.Text.UTF8Encoding
- Dim byteData As Byte() = encoding.GetBytes(postdata)
- Dim request As System.Net.HttpWebRequest
- request = DirectCast(Net.HttpWebRequest.Create(URL), Net.HttpWebRequest)
- request.Method = "POST"
- request.ContentType = "application/x-www-form-urlencoded"
- request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
- request.ContentLength = byteData.Length
- Dim postreqstream As System.IO.Stream = request.GetRequestStream()
- postreqstream.Write(byteData, 0, byteData.Length)
- postreqstream.Close()
- Dim response As System.Net.HttpWebResponse
- response = DirectCast(request.GetResponse(), Net.HttpWebResponse)
- Dim postreqreader As New System.IO.StreamReader(response.GetResponseStream())
- PostHTTPWebrequest = postreqreader.ReadToEnd
- End Function
- Public Function botresponse(ByVal user As String) As String
- Dim bot As String
- bot = PostHTTPWebrequest("http://78.47.186.254/simpleq.php", "hi=" & user)
- bot = Mid(bot, (InStr(bot, ">")) + 1)
- Do Until Mid(bot, 1, 1) <> Chr(13) And Mid(bot, 1, 1) <> Chr(10)
- bot = Mid(bot, 2)
- Loop
- bot = Mid(bot, 1, InStr(bot, "<") - 1)
- botresponse = bot
- End Function
- End Module
Advertisement
Add Comment
Please, Sign In to add comment