public string getHttpPage(string url)
{
mBaseUrl = getBaseUrl(url);
string str;
System.Net.WebClient wc=new WebClient();
byte[] buffer=wc.DownloadData(url);
str = System.Text.Encoding.Default.GetString(buffer);
return str;
}
public string getHttpPage(string url,string encoding)
{
mBaseUrl = getBaseUrl(url);
string str;
System.Net.WebClient wc = new WebClient();
byte[] buffer = wc.DownloadData(url);
str = System.Text.Encoding.GetEncoding(encoding).GetString(buffer);
return str;
} public bool getHttpFile(string url,string savePath)
{
mBaseUrl = getBaseUrl(url);
try
{
System.Net.WebClient wc = new WebClient();
wc.DownloadFile(url, savePath);
if (!wc.IsBusy)
{
wc.Dispose();
}
return true;
}
catch
{
return false;
}
} public byte[] getHttpData(string url)
{
mBaseUrl = getBaseUrl(url);
byte[] buf;
System.Net.WebClient wc = new WebClient();
buf=wc.DownloadData(url);
wc.Dispose();
return buf;
}
{
mBaseUrl = getBaseUrl(url);
string str;
System.Net.WebClient wc=new WebClient();
byte[] buffer=wc.DownloadData(url);
str = System.Text.Encoding.Default.GetString(buffer);
return str;
}
public string getHttpPage(string url,string encoding)
{
mBaseUrl = getBaseUrl(url);
string str;
System.Net.WebClient wc = new WebClient();
byte[] buffer = wc.DownloadData(url);
str = System.Text.Encoding.GetEncoding(encoding).GetString(buffer);
return str;
} public bool getHttpFile(string url,string savePath)
{
mBaseUrl = getBaseUrl(url);
try
{
System.Net.WebClient wc = new WebClient();
wc.DownloadFile(url, savePath);
if (!wc.IsBusy)
{
wc.Dispose();
}
return true;
}
catch
{
return false;
}
} public byte[] getHttpData(string url)
{
mBaseUrl = getBaseUrl(url);
byte[] buf;
System.Net.WebClient wc = new WebClient();
buf=wc.DownloadData(url);
wc.Dispose();
return buf;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货