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>

你可能感兴趣的:(proxy)