Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using HTTP Post from within a VFP program?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00832258
Message ID:
00832360
Views:
32
Hi Andrew,

Certainly I have to promote my own stuff -- Windows API at http://www.news2news.com/vfp?group=92

Though this time I want you to take a look at this way of sending POST HTTP requests:
LOCAL oHttp, cUrl, cRawData
cUrl = 'http://...'
cRawData = 'any raw data or leave it empty'
oHttp = CreateObject('MSXML2.ServerXMLHTTP')

WITH oHttp
	.Open('POST', cUrl, 0)
	.SetRequestHeader('myheader', 'any value')

	WAIT WINDOW NOWAIT 'Executing remote...'
	.Send(cRawData)
	WAIT CLEAR

	* obtaining a response header
	? .GetResponseHeader('RequestError')  && if such header exists

	? .StatusText
	? .GetAllResponseHeaders()
	
	DELETE FILE tmp.txt
	IF StrToFile(.ResponseText, 'tmp.txt') <> 0
		MODI FILE tmp.txt NOWAIT
	ENDIF
ENDWITH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform