模拟表单发送post
表单代码:
<FORM action="http://www.ip138.com/post/search.asp" method=post name="zoneform" οnsubmit="return checkZone();" target="searchwindow">
<TD align=middle width=80 noswap class="f13">区号查询地名</TD>
<TD align=middle><INPUT name="action" type="hidden" value="zone2area"><INPUT class=tdc name="zone" size=10> <INPUT class=bdtj name=B1 type=submit value="查 询">
</TD>
</FORM>
模拟代码:
var_tel=request.querystring("Phone")
url="http://www.ip138.com/post/search.asp"
set Http=server.createobject("MSXML2.XMLHTTP")
if(mid(var_tel,2,1)) <3 then var_tel=left(var_tel,3) else var_tel=left(var_tel,4)'得到区号
strA="action=zone2area&zone="&var_tel
With Http
.Open "POST", url, False
.setRequestHeader "Content-Length",len(strA)
.setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"
.Send strA
if .status<>200 then
response.write"alert('查不到地区')"
else
html =bytesToBstr(.responseBody,"GB2312")
response.Write html
end if
End With
相关文章:http://down.4567.cn/Article/HTML/1277.html
xmlhttp发送模拟表单发送Post请求