長效ip在c#中使用方法,固定長效爬蟲代理ip使用c#進(jìn)行大數(shù)據(jù)采集
時(shí)間:2022-08-10 來源:楓之葉網(wǎng)絡(luò)
楓之葉網(wǎng)絡(luò)的很多客戶都是用c#語言使用長效ip來進(jìn)行大數(shù)據(jù)采集,以下是小編匯總的c#語言使用楓之葉網(wǎng)絡(luò)固定長效爬蟲代理ip的使用demon:
string targetUrl = "http://www.xbltjxp.cn";
string proxyHost = "http://www.xbltjxp.cn"";
string proxyPort = "65011";
string proxyUser = "pachongdaili";
string proxyPass = "pachongdaili";
var proxy = new WebProxy();
proxy.Address = new Uri(string.Format("{0}:{1}", proxyHost, proxyPort));
proxy.Credentials = new NetworkCredential(proxyUser, proxyPass);
ServicePointManager.Expect100Continue = false;
var request = WebRequest.Create(targetUrl) as HttpWebRequest;
request.AllowAutoRedirect = true;
request.KeepAlive = true;
request.Method = "GET";
request.Proxy = proxy;
using (var response = request.GetResponse() as HttpWebResponse)
using (var sr = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
{
string htmlStr = sr.ReadToEnd();
}
當(dāng)前地址:http://www.xbltjxp.cn/support/a451.html 客服聯(lián)系QQ:475685360
楓之葉網(wǎng)絡(luò)的很多客戶都是用c#語言使用長效ip來進(jìn)行大數(shù)據(jù)采集,以下是小編匯總的c#語言使用楓之葉網(wǎng)絡(luò)固定長效爬蟲代理ip的使用demon:
string targetUrl = "http://www.xbltjxp.cn";
string proxyHost = "http://www.xbltjxp.cn"";
string proxyPort = "65011";
string proxyUser = "pachongdaili";
string proxyPass = "pachongdaili";
var proxy = new WebProxy();
proxy.Address = new Uri(string.Format("{0}:{1}", proxyHost, proxyPort));
proxy.Credentials = new NetworkCredential(proxyUser, proxyPass);
ServicePointManager.Expect100Continue = false;
var request = WebRequest.Create(targetUrl) as HttpWebRequest;
request.AllowAutoRedirect = true;
request.KeepAlive = true;
request.Method = "GET";
request.Proxy = proxy;
using (var response = request.GetResponse() as HttpWebResponse)
using (var sr = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
{
string htmlStr = sr.ReadToEnd();
}
當(dāng)前地址:http://www.xbltjxp.cn/support/a451.html 客服聯(lián)系QQ:475685360