Use this class to send HTTP POST, HTTP GET and other HTTP requests. Use the following code to test it:
SET MEMOWIDTH TO 120
#DEFINE ccUrl "http://www.news2news.com/vfp/?example=397"
oHttp = CreateObject("WinHttpRequest")
WITH oHttp
IF Not .Open("GET", ccUrl)
? "Error:", .ErrorCode, .ErrorMsg
ELSE
IF Not .Send()
? "Error:", .ErrorCode, .ErrorMsg
ELSE
? .Status
? .StatusText
? .GetAllResponseHeaders()
? .GetResponseHeader("connection:")
? "Response length:", .ResponseLen
SET SAFETY OFF
StrToFile(.ResponseText, "tmp.txt")
SET SAFETY ON
MODI FILE tmp.txt NOWAIT
ENDIF
ENDIF
ENDWITH
There is a similar class built on WinINet functions: Custom HttpRequest class (WinINet). |