[VB.Net] Pusher API Posted Nofitication On Web
![[VB.Net] Pusher API Posted Nofitication On Web [VB.Net] Pusher API Posted Nofitication On Web](https://1.bp.blogspot.com/-udXxHoijBpE/VRKcawP8k6I/AAAAAAAAFCw/Mg5QcoY_IUU/s1600/%5BVB.Net%5D%2BPusher%2BAPI%2BPosted%2BNofitication%2BOn%2BWeb.png)
Lấy theo ý tưởng của NamCoder về bài viết "Hướng dẫn Pusher - Viết ứng dụng thời gian thực" mình đã lên ý tưởng và phát triển nó ra thành Client sử dụng trên Windows , Nhìn vậy thôi chứ mình dùng hàm HTTP Request
Code VB.NET do mình viết
Dim postData As String = "http://domain.com/execute.php&message=" & TextBox1.Text & "&username=" & TextBox3.Text Dim tempCookies As New CookieContainer Dim encoding As New UTF8Encoding Dim byteData As Byte() = encoding.GetBytes(postData) Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("http://pusher.16mb.com/execute.php"), HttpWebRequest) postReq.Method = "POST" postReq.KeepAlive = True postReq.CookieContainer = tempCookies postReq.ContentType = "application/x-www-form-urlencoded" postReq.Referer = "http://pusher.16mb.com/user.html" postReq.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)" postReq.ContentLength = byteData.Length 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) logincookie = tempCookies Dim postreqreader As New StreamReader(postresponse.GetResponseStream()) Dim thepage As String = postreqreader.ReadToEnd TextBox3.Enabled = True
Nhìn vào code bên trên chắc các bạn biết thêm những gì rồi: 2 Textbox
Hoặc các bạn có thể Download Full Code ở bên dưới :)
Download Code VB.Net Download API Pusher