Example #1
0
 private void btnWininet_Click(object sender, EventArgs e)
 {
     Random r = new Random();
     Wininet wnet = new Wininet();
     pic.Image = wnet.GetImage(picurl);
 }
Example #2
0
 private void button7_Click(object sender, EventArgs e)
 {
     Wininet wi = new Wininet();
     StringBuilder sb = new StringBuilder();
     sb.Append("Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\r\n");
     sb.Append("Content-Type:application/x-www-form-urlencoded\r\n");
     sb.Append("Accept-Language:zh-cn\r\n");
     sb.Append("Referer:" + "http://mrtx.u193.com/");//增加referer头
     string str = wi.PostData("http://www.u193.com/opt.php?do=login", "username=ceshiyixia1&password=111111", sb);
     str = wi.GetData("http://mrtx.u193.com/");
 }
Example #3
0
 private void btnProxy_Click(object sender, EventArgs e)
 {
     string url = "http://1111.ip138.com/ic.asp"; //请求地址
     string ip = "127.0.0.1:8888"; //设置代理IP地址
     HttpItems item = new HttpItems();
     item.URL = url;
     item.ProxyIp = ip;
     //如果代理服务器需要用户名与密码请参考此设置
     //item.ProxyUserName = "******";//如果代理服务器需要用户名
     //item.ProxyPwd = "密码";//如果代理服务器需要密码
     HttpResults hr = http.GetHtml(item);
     // hr.Html; 请求具体结果
     Wininet winet = new Wininet();
     //Post
     string postdata = "GetHtmlPro 如果传入PostData参数则认为当前是Post请求";
     string Posthtml = winet.GetDataPro(winet.GetHtmlPro(url, postdata, ip));
     //Get
     string Gethtml = winet.GetDataPro(winet.GetHtmlPro(url, "", ip));
     //使用代理请求图片时
     Image img = winet.GetImage(winet.GetHtmlPro("图片URL", "", ip));
 }