• 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>

  • 相关阅读:
    解决 ThinkPHP Undefined class constant 'MYSQL_ATTR_INIT_COM
    Linux 下 Redis 服务 Shell启动脚本
    关于 Apache 2.4 配置PHP时的错误记录
    关于 linux ssh 的配置.
    Linux 编译安装 apache 2.4
    linux 系统下配置安装 java jdk 图文流程
    关于 jsp:include 传参的用法
    leetcode c++做题思路和题解(3)——栈的例题和总结
    leetcode c++做题思路和题解(4)——队列的例题和总结
    leetcode c++做题思路和题解(2)——链表的例题和总结
  • 原文地址:https://www.cnblogs.com/IsNull/p/1931591.html
Copyright © 2020-2023  润新知