在线PhotoShop,推荐 Online Photo Editor | Pixlr Editor | Autodesk Pixlr
在线ICO转换,推荐 在线ICON图标转换工具 可转软件用ICON和网站用favicon
在线GET和POST测试,推荐 GET和POST测试(支持get和post参数同时请求)
在线Regex正则测试,推荐 Regex
在线PhotoShop,推荐 Online Photo Editor | Pixlr Editor | Autodesk Pixlr
在线ICO转换,推荐 在线ICON图标转换工具 可转软件用ICON和网站用favicon
在线GET和POST测试,推荐 GET和POST测试(支持get和post参数同时请求)
在线Regex正则测试,推荐 Regex
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
Imports System.Net Imports System.IO Imports System.Text Public Class Form1 Const ConnectURL = "http://www.raineggplant.com/logon.php" Const HomeURL = "http://www.raineggplant.com" Private Function RegularPage(ByVal URL As String, ByVal CookieJar As CookieContainer) As String '携带CookieJar中的Cookie访问URL Dim reader As StreamReader Dim Request As HttpWebRequest = HttpWebRequest.Create(URL) Request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14" Request.AllowAutoRedirect = False Request.CookieContainer = CookieJar Dim Response As HttpWebResponse = Request.GetResponse() reader = New StreamReader(Response.GetResponseStream()) Return reader.ReadToEnd() Response.Close() End Function Private Sub LogonPage(ByVal URL As String, ByRef CookieJar As CookieContainer, ByVal PostData As String) '访问URL获取Cookie Dim reader As StreamReader Dim Request As HttpWebRequest = HttpWebRequest.Create(URL) Request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14" Request.CookieContainer = CookieJar Request.AllowAutoRedirect = False Request.ContentType = "application/x-www-form-urlencoded" PostData = "username=isiria&password=ceciestunmdp" Request.Method = "POST" Request.ContentLength = PostData.Length Dim requestStream As Stream = Request.GetRequestStream() Dim postBytes As Byte() = Encoding.ASCII.GetBytes(PostData) requestStream.Write(postBytes, 0, postBytes.Length) requestStream.Close() Dim Response As HttpWebResponse = Request.GetResponse() For Each tempCookie In Response.Cookies CookieJar.Add(tempCookie) Next reader = New StreamReader(Response.GetResponseStream()) Response.Close() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim CookieJar As New CookieContainer Dim PostData As String Try 'Logon PostData = "username=admin&password=password" LogonPage(ConnectURL, CookieJar, PostData) 'Homepage RichTextBox1.AppendText(RegularPage(HomeURL, CookieJar)) Catch ex As Exception MessageBox.Show(ex.Message.ToString) End Try End Sub End Class |
完全可以媲美KK录像机等。小巧方便,功能强大!
近期评论