利用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, falsenullnull);
                XmlHttp.send(
null);

                
if (XmlHttp.readyState == 4)
                {
                    vs 
= XmlHttp.responseText;
                }
            }
            
catch (Exception ex)
            {
                
throw new exception(ex.Message);
            }

相关文章: