使用xmlhttp给一个xmlhttp简单的例子:<style type="text/css">
<!--
body{background: #fff;margin:0;}
table,td,img,form{border: none;margin: 0;padding: 0;}
td,p,li,select,input,textarea{font-size:12px;}
a{text-decoration:underline;}
a:link{color:#00007f;}
a:visited{color:#00007f;}
a:active,a:hover{color:#f00;}
-->
</style>
<% 
On Error Resume Next 
Server.ScriptTimeOut=9999999 
Function getHTTPPage(Path) 
t = GetBody(Path) 
getHTTPPage=BytesToBstr(t,"GB2312") 
End function 
Function GetBody(url) 
on error resume next 
Set Retrieval = CreateObject("Microsoft.XMLHTTP") 
With Retrieval 
.Open "Get", url, False, "", "" 
.Send 
GetBody = .ResponseBody 
End With 
Set Retrieval = Nothing 
End Function Function BytesToBstr(body,Cset) 
dim objstream 
set objstream = Server.CreateObject("adodb.stream") 
objstream.Type = 1 
objstream.Mode =3 
objstream.Open 
objstream.Write body 
objstream.Position = 0 
objstream.Type = 2 
objstream.Charset = Cset 
BytesToBstr = objstream.ReadText 
objstream.Close 
set objstream = nothing 
End Function 
Function Newstring(wstr,strng) 
Newstring=Instr(lcase(wstr),lcase(strng)) 
if Newstring<=0 then Newstring=Len(wstr) 
End Function 
Dim wstr,str,url,start,over,dtime url="http://www.ip138.com/ip2city.asp"
wstr=getHTTPPage(url) 
start=Newstring(wstr,"[") 
over=Newstring(wstr,"]") 
body=mid(wstr,start+1,over-start-1)
start1=Newstring(wstr,"来自:") 
over1=Newstring(wstr,"</center>")
body1=mid(wstr,start1+3,over1-start1-3)
response.write body
response.write body1
%>

解决方案 »

  1.   


    你的是PHP的?
    如果是那就换成PHP的
      

  2.   

    不过,PHP调用xmlhttp不太方便
    常规处理思路是这样的:搜索处理页:
    第一步:根据参数发送相关文件至google(fsocket,ajxa的xmlhtt也可)
    获得google返回的原码文件(如果是get请求的也可用file_get_content())
    第二:截取源码内容,去掉google其他内容,只要正文部分(字符截取,如能dom化的可用dom,xmlhttp的就可以)
    第三:在自已页上输出相关内容