binghc 发表于 2012-3-1 00:45:10

手机归属如何post提交查询

本帖最后由 binghc 于 2012-3-1 11:49 编辑

http://www.1234i.com/
这个网站如何post提交号码段查询

这网站编码是GB2312 ,au3能转换成这种编码么,binarytostring好像不支持这个编码啊

my788522 发表于 2012-3-1 11:53:34

$oHTTP = ObjCreate("MSXML2.XMLHTTP")
        $oHTTP.Open("post", "http://www.1234i.com/www.u9cn.com/sj/p/", False)
        $oHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
        $oHTTP.Send("haomas=13558276508&Submit=%C5%FA%C1%BF%B2%E9%CA%D6%BB%FA%BA%C5%C2%EB");post关键数据
        $ab = BinaryToString($oHTTP.responsebody)
        MsgBox(0,"单查询",$ab)
       
        $oHTTP = ObjCreate("MSXML2.XMLHTTP")
        $oHTTP.Open("post", "http://www.1234i.com/www.u9cn.com/sj/p/", False)
        $oHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
        $oHTTP.Send("haomas=13558666808%0D%0A15984554785&Submit=%C5%FA%C1%BF%B2%E9%CA%D6%BB%FA%BA%C5%C2%EB");post关键数据
        $ab = BinaryToString($oHTTP.responsebody)
        MsgBox(0,"批量查询",$ab)

再用正则提取即可

binghc 发表于 2012-3-1 12:05:24

回复 2# my788522


请问,这两个submit参数怎么算出来的
Submit=%C5%FA%C1%BF%B2%E9%CA%D6%BB%FA%BA%C5%C2%EB"

my788522 发表于 2012-3-1 12:07:58

其实这个Submit=%C5%FA%C1%BF%B2%E9%CA%D6%BB%FA%BA%C5%C2%EB
就是那个按钮上的字....
这样写也可以

Submit=encode_url_string("批量查手机号码")

Func encode_url_string($_the_string_to_encode = "")

        Local $the_string_binary = "", $the_string_encoded = "", $the_string_binary_single, $_the_string_to_encode_single

        For $i = 1 To StringLen($_the_string_to_encode)

                $_the_string_to_encode_single = StringMid($_the_string_to_encode, $i, 1)

                If StringRegExp($_the_string_to_encode_single, "[\w-_\[\]#/=\.]", 0) Then

                        $the_string_encoded &= $_the_string_to_encode_single

                Else

                        $the_string_binary_single = StringToBinary(StringMid($_the_string_to_encode, $i, 1) & " ")

                        $the_string_binary_single = StringReplace($the_string_binary_single, "0x", "")

                        $the_string_encoded &= "%" & StringMid($the_string_binary_single, 1, 2)

                        $the_string_encoded &= "%" & StringMid($the_string_binary_single, 3, 2)

                EndIf

        Next

        Return $the_string_encoded

EndFunc   ;==>encode_url_string

binghc 发表于 2012-3-1 12:17:10

回复 2# my788522


    $oHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
这句好像是编码用的,"application/x-www-form-urlencoded"这个怎么来的?

my788522 发表于 2012-3-1 12:18:12

网站编码就是如此 使用httpwatch之类的抓包工具即可查看

binghc 发表于 2012-3-1 13:22:46

回复 6# my788522
   恩,知道了,还有一个问题
responsebodydu获取到的是二进制流,而responsetext获取到的是字符串?

my788522 发表于 2012-3-1 13:25:05

responsetext获取的字符串编码不正确的 你无法看到其中的中文 估计这个只是用UTF读取的

binghc 发表于 2012-3-1 13:32:03

回复 2# my788522
    我用httpwatch查看,他post上去的submit不是你这个值啊,咋回事 ?

my788522 发表于 2012-3-1 15:46:27

说明你不是使用的这个功能而已
我是点的那个批量

binghc 发表于 2012-3-1 20:13:29

回复 2# my788522


    这是编码的,有没有解码的?

binghc 发表于 2012-3-1 20:16:02

回复 4# my788522


    知道怎么回事儿了!加个20就能解码

ybb03 发表于 2012-3-3 02:00:55

字符串编码今天都找了几个在看,正在写一个网页挂机软件,这个要用的
页: [1]
查看完整版本: 手机归属如何post提交查询