利用xmlhttp根据网址调用接口获取数据
//引入com组件中的microsoft.xml.3.0
using MSXML2;
public void GetCon(String Url)
{
string vs = string.empty;
try
{
XMLHTTP XmlHttp = new MSXML2.XMLHTTPClass();
XmlHttp.open("get", url, false, null, null);
XmlHttp.send(null);
if (XmlHttp.readyState == 4)
{
vs = XmlHttp.responseText;
}
}
catch (Exception ex)
{
throw new exception(ex.Message);
}
public void GetCon(String Url)
{
string vs = string.empty;
try
{
XMLHTTP XmlHttp = new MSXML2.XMLHTTPClass();
XmlHttp.open("get", url, false, null, null);
XmlHttp.send(null);
if (XmlHttp.readyState == 4)
{
vs = XmlHttp.responseText;
}
}
catch (Exception ex)
{
throw new exception(ex.Message);
}