找回密码
 加入
搜索
查看: 1669|回复: 0

[IE类操作] [已解决]公网IP网页获取后,中文乱码问题

[复制链接]
发表于 2016-6-19 11:37:08 | 显示全部楼层 |阅读模式
本帖最后由 elexy 于 2016-6-19 12:53 编辑
#include <INet.au3>

Global $geturl = "http://1212.ip138.com/ic.asp"
$WinHttp = ObjCreate("WinHttp.WinHttprequest.5.1")
$WinHttp.Open("GET", $geturl, False)
$WinHttp.Send()
$WinHttp.WaitForResponse
Global $body = BinaryToString($WinHttp.Responsebody, 4)
$aIP = StringRegExp($body, '\[(\d[\d.]+)\]', 3)
MsgBox(64, $aIP[0], $body)
ClipPut($body)
$WinHttp = 0

Local $str = BinaryToString(_INetGetSource('http://1212.ip138.com/ic.asp', 0), 4)
MsgBox(64,0,$str)    

;两种方式中文都是乱码,导致抓不到地区,请高手们修改一下。
发表于 2016-6-19 12:05:07 | 显示全部楼层
在群里问的是你吧,和你说了是编码问题。ANSI
#include <INet.au3>

Global $geturl = "http://1212.ip138.com/ic.asp"
$WinHttp = ObjCreate("WinHttp.WinHttprequest.5.1")
$WinHttp.Open("GET", $geturl, False)
$WinHttp.Send()
$WinHttp.WaitForResponse
Global $body = BinaryToString($WinHttp.Responsebody, 1)
$aIP = StringRegExp($body, '\[(\d[\d.]+)\]', 3)
MsgBox(64, $aIP[0], $body)
ClipPut($body)
$WinHttp = 0

Local $str = BinaryToString(_INetGetSource('http://1212.ip138.com/ic.asp', 0), 1)
MsgBox(64, 0, $str)
 楼主| 发表于 2016-6-19 12:54:21 | 显示全部楼层
谢谢楼上!!! 原来是4改成1。。。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-19 23:25 , Processed in 0.078772 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表