地址是:http://dev.5cfan.com/go.php
#include-once
#include "WinHttp.au3"
#include <array.au3>
#include <IE.au3>
; Register Callback function
;创建一个HTTP链接
Global $hOpen = _WinHttpOpen()
If @error Then
MsgBox(48, "Error", "Error initializing the usage of WinHTTP functions.")
Exit 1
EndIf
;链接至服务器
Global $cookie="sa=1; sb=2"
Global $hConnect = _WinHttpConnect($hOpen, "dev.5cfan.com")
Global $sendmessage=""
Global $sReturned= WInHttpGetMessage($hConnect,"GET","/go.php",$sendmessage,$cookie)
MsgBox(0,"",$sReturned)
_WinHttpCloseHandle($hOpen)
;作用:获取信息
;链接,类型平post还是get,Page,发送的信息;cookie
Func WInHttpGetMessage($Connect,$Type,$Page,$message="",$cookie="")
Local $hRequest_E = _WinHttpOpenRequest($Connect, $Type,$Page)
Local $sHeader=""
If $cookie<>"" Then
_WinHttpAddRequestHeaders($hRequest_E, "Cookie:"&$cookie) ;带着cookie走
EndIf
_WinHttpSendRequest($hRequest_E, "Content-Type: application/x-www-form-urlencoded",$message)
_WinHttpReceiveResponse($hRequest_E)
$sHeader = _WinHttpQueryHeaders($hRequest_E,43)
MsgBox(0,"",$sHeader)
Local $sReturned_V
If _WinHttpQueryDataAvailable($hRequest_E) Then ; if there is data
Do
$sReturned_V &= _WinHttpReadData($hRequest_E,1)
Until @error
EndIf
_WinHttpCloseHandle($hRequest_E)
Return $sReturned_V
EndFunc
返回的结果
|