zoukankan      html  css  js  c++  java
  • Proxy代理

     
    返回
    Proxy代理程序示例代码
    ASP示例代码
    <%@LANGUAGE="VBScript" CODEPAGE="936"%>
    <%
    Option Explicit

    Dim domain
    Dim keywords

    Dim xmlHttp
    Dim postData

    domain=Request("domain")
    keywords=Request("keywords")

    If domain="" OR keywords="" Then
        Response.End
    End If

    Set xmlHttp=Server.CreateObject("Microsoft.XMLHTTP")    'MSXML2.XMLHTTP
    postData = "ajaxaction=bqipd&u="&domain&"&q="+keywords
    xmlHttp.Open "POST","http://www.brandqq.com/AjaxPostResponse.aspx",false

    xmlHttp.SetRequestHeader "Content-Type","application/x-www-form-urlencoded"
    xmlHttp.Send(postData)

    Response.Charset="GB2312"
    Response.Write xmlHttp.responseText
    Response.End
    %>
    ASP.NET示例代码(c#)
    <%@ Page Language="C#" %>
    <%@ Import Namespace="System.Net" %>
    <%@ Import Namespace="System.IO" %>

    <script runat="server">
        void Page_Load(object s, EventArgs e)
        {
            if (Request["domain"] == null || Request["keywords"] == null)
            {
                return;
            }

            string domain = Request["domain"].Trim();
            string keywords = Request["keywords"].Trim();


            WebRequest request = WebRequest.Create("http://www.brandqq.com/AjaxPostResponse.aspx");
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
           
            byte[] data = Encoding.UTF8.GetBytes("AjaxAction=bqipd&u=" + domain + "&q=" + keywords);

            Stream dataStream = request.GetRequestStream();
            dataStream.Write(data, 0, data.Length);
            dataStream.Close();
           

            WebResponse response = request.GetResponse();

            StreamReader reader = new StreamReader(response.GetResponseStream());
            string xml = reader.ReadToEnd();
            reader.Close();
           
            Response.ContentEncoding = Encoding.UTF8;
            Response.ContentType = "text/xml";
            Response.Write(xml);
            Response.End();
        }
    </script>

  • 相关阅读:
    窗体控件随窗体大小改变(包括字体大小)
    Silverlight数据加载时,等待图标显示与隐藏(Loading)
    鼠标经过时,地图上的每个城市变颜色并且有提示框
    开始博客生活
    光纤
    静态路由配置(Static Routing)
    对称加密与非对称加密
    RIP Debug 过程
    WORD 固定表头自动生成/在Word表格接续页加上重复表格标题
    RIP路由
  • 原文地址:https://www.cnblogs.com/IsNull/p/1931591.html
Copyright © 2011-2022 走看看