Global Const $AU3_VERSION = StringSplit(@AutoItVersion, ".")
Global Const $AU3_UNICODE = Number($AU3_VERSION[2] & "." & $AU3_VERSION[3]) >= 2.13
Global $WIN32_FTYPE, $WIN32_TCHAR, $WIN32_TSTR
If $AU3_UNICODE Then
$WIN32_FTYPE = "W"
$WIN32_TCHAR = "wchar"
$WIN32_TSTR = "wstr"
Else
$WIN32_FTYPE = "A"
$WIN32_TCHAR = "char"
$WIN32_TSTR = "str"
EndIf
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
Dim $BaiduCookie
$BaiduCookie = _WinINet_InternetGetCookie("http://www.baidu.com") ;得到本地百度的cookie
While 1
$num = Random(0,1)
$oHTTP.Open("GET","http://act.hi.baidu.com/pet/3e01bbc3beb34f6e4c696e65cde2b9d22105/eat?t="&$num)
;3e01bbc3beb34f6e4c696e65cde2b9d22105 这部分在有宠物的页面内看源代码 搜苏 "ACT_USER_PTR" 对应的,是宠物对应的
$oHTTP.setRequestHeader("Referer","http://hi.baidu.com/iokey")
;有百度宠物的博客主页,写成我的刷别人的也可以,但是没有不行
$oHTTP.setRequestHeader("Cookie",$BaiduCookie)
$oHTTP.Send()
$HTMLSource = $oHTTP.Responsetext
TrayTip("宠物信息",$HTMLSource,10)
;如果多次显示一样的,则说明喂饱了,另外一种可能很就没喂了!
Sleep(3000)
WEnd
Func _WinINet_InternetGetCookie($sUrl, $iBufferSize = 2048)
; Set data/structures up
Local $tSize = DllStructCreate("dword")
DllStructSetData($tSize, 1, $iBufferSize)
Local $tCookieData = DllStructCreate($WIN32_TCHAR & "[" & $iBufferSize & "]")
; Make DLL call
Local $avResult = DllCall("wininet.dll", "int", "InternetGetCookie" & $WIN32_FTYPE, $WIN32_TSTR, $sUrl, "ptr", 0, "ptr", DllStructGetPtr($tCookieData), "ptr", DllStructGetPtr($tSize))
; Return response
If @error Then Return SetError(1, 0, "")
If Not $avResult[0] Then Return SetError(1, DllStructGetData($tSize, 1), "")
Return DllStructGetData($tCookieData, 1)
EndFunc ;==>_WinINet_InternetGetCookie



































































