快捷搜索:  as  2018  FtCWSyGV  С˵  test  xxx  Ψһ  w3viyKQx

和记娱乐app官网:vb调用winInetAPI接口post数据到指定的url



『vb调用winInet API接口post数据到指定的url』

'This module is called modWinInet.bas. Use the SplitAddr() function to get the address in the correct format for PostInfo.

Option E和记娱乐app官网xplicit

'Author:Sam Huggill

'Email:sam@vbsquare.com

Private Declare Function InternetOpen Lib "wininet.dll" _

Alias "InternetOpenA" _

(ByVal lpszCallerName As String, _

ByVal dwAccessType As Long, _

ByVal lpszProxyName As String, _

ByVal lpszProxyBypass As String, _

ByVal dwFlags As Long) As Long

Private Declare Function InternetConnect Lib "wininet.dll" _

Alias "InternetConnectA" _

(ByVal hInternetSession As Long, _

ByVal lpszServerName As String, _

ByVal nProxyPort As Integer, _

ByVal lpszUsername As String, _

ByVal lpszPassword As String, _

ByVal dwService As Long, _

ByVal dwFlags As Long, _

ByVal dwContext As Long) As Long

Private Declare Function InternetReadFile Lib "wininet.dll" _

(ByVal h和记娱乐app官网File As Long, _

ByVal sBuffer As String, _

ByVal lNumBytesToRead As Long, _

lNumberOfBytesRead As Long) As Integer

Private Declare Function HttpOpenRequest Lib "wininet.dll" _

Alias "HttpOpenRequestA" _

(ByVal hInternetSession As Long, _

ByVal lpszVerb As String, _

ByVal lpszObjectName As String, _

ByVal lpszVersion As String, _

ByVal lpszReferer As String, _

ByVal lpszAcceptTypes As Long, _

ByVal dwFlags As Long, _

ByVal dwContext As Long) As Long

Private Declare Function HttpSendRequest Lib "wininet.dll" _

Alias "HttpSendRequestA" _

(和记娱乐app官网ByVal hHttpRequest As Long, _

ByVal sHeaders As String, _

ByVal lHeadersLength As Long, _

ByVal sOptional As String, _

ByVal lOptionalLength As Long) As Boolean

Private Declare Function InternetCloseHandle Lib "wininet.dll" _

(ByVal hInternetHandle As Long) As Boolean

Private Declare Function HttpAddRequestHeaders Lib "wininet.dll" _

Alias "HttpAddRequestHeadersA" _

(ByVal hHttpReq和记娱乐app官网uest As Long, _

ByVal sHeaders As String, _

ByVal lHeadersLength As Long, _

ByVal lModifiers As Long) As Integer

Public Function PostI和记娱乐app官网nfo$(srv$, port$, script$, postdat$)

Dim hInternetOpen As Long

Dim hInternetConnect As Long

Dim hHttpOpenRequest As Long

Dim bRet As Boolean

hInternetOpen = 0

hInternetConnect = 0

hHttpOpenRequest = 0

'Use registry access settings.

Const INTERNET_OPEN_TYPE_PRECONFIG = 0

hInternetOpen = InternetOpen("http generic", _

INTERNET_OPEN_TYPE_PRECONFIG, _

vbNullString, _

vbNullString, _

0)

If hInternetOpen0 Then

'Brings the data across the wire even if it locally cached.

Const INTERNET_FLAG_RELOAD = &H80000000

hHttpOpenRequest = HttpOpenRequest(hInternetConnect, _

"POST", _

script$, _

"HTTP/1.0", _

vbNullString, _

0, _

INTERNET_FLAG_RELOAD, _

0)

If hHttpOpenRequest

您可能还会对下面的文章感兴趣: