Cshap 使用http发起请求

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
using System;
using System.IO;
using System.Net;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace webclient
{
    class Program
    {
        static void Main(string[] args)
        {          
            string url = "http://v010.test.s.qq.com/Login.php";
            WebRequest request = WebRequest.Create(url);
            request.Credentials = CredentialCache.DefaultCredentials;// 拿到一个请求         
            HttpWebResponse response = (HttpWebResponse)request.GetResponse ();          
            Console.WriteLine (response.StatusDescription);
            Stream dataStream = response.GetResponseStream ();          
            StreamReader reader = new StreamReader (dataStream);
            string responseFromServer = reader.ReadToEnd ();
            Console.WriteLine (responseFromServer);          
            reader.Close ();
            dataStream.Close ();
            response.Close ();
        }
    }
}

此种方式,可以测试webgame某个重点环节。

本文转自博客园知识天地的博客,原文链接:Cshap 使用http发起请求,如需转载请自行联系原博主。


上一篇:基于ECS快速搭建Docker环境 笔记


下一篇:基于ECS快速搭建FTP服务器 笔记