zoukankan      html  css  js  c++  java
  • 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某个重点环节。
  • 相关阅读:
    notepad++的使用
    windows下的ubuntu
    VMware Tools安装
    Terminal命令
    Linux文件操作
    vim学习
    Windows桌面美化
    求解移动字符串问题
    求解回文序列问题
    用Git命令把本地项目,提交到远程仓库
  • 原文地址:https://www.cnblogs.com/mfryf/p/3616837.html
Copyright © 2011-2022 走看看