|
玄机论坛-专业的C#交流论坛 交流QQ群: 16885911如有疑问,请加入官方群询问
您需要 登录 才可以下载或查看,没有帐号?关闭注册
x
HttpCode使用篇
使用HttpCode时,请先引用 System.Web
Framework 4.0 时需要引用 System.Web.Extensions
|
如何为httpcode 设置代理
[mw_shl_code=csharp,true]
HttpItems item = new HttpItems();
item.URL = "http://1111.ip138.com/ic.asp"; //请求地址
item.ProxyIp = "127.0.0.1:8888"; //设置代理IP地址
//如果代理服务器需要用户名与密码请参考此设置
item.ProxyUserName = "用户名";//如果代理服务器需要用户名
item.ProxyPwd = "密码";//如果代理服务器需要密码
HttpResults hr = http.GetHtml(item);
// hr.Html; 请求具体结果
[/mw_shl_code]
[mw_shl_code=csharp,true]
// Wininet 方式
string ip = "202.106.169.142:80"; //设置代理IP地址
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));
[/mw_shl_code]
|
|