Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to send data via HTTP Post method

Status
Not open for further replies.

dejanj

Programmer
Apr 22, 2002
25
AU
Dear All,

I 've found this article from Fox Advisor ( Jul 2002 ) in TIps section.

When i tried i can't seem to be able to send data to HTTP the method open returns the contents of ASP page.

According to article i should be able to send data via Post to ASP page

Maybe someone can test it and tell me what is wrong.
I would appreciate response.

I made the ASP page with the name httpPostTest.asp
on which i have put form with textbox txtMyHtmlTextBox

Still when i execute the function from command mode i type
?senddata()

with no parameters i got the content of httpPostTest.ASP page

Here is the code ( using MSXML2.DLL) :

FUNCTION SendData (tcDataToSend, tcUrlTOPostTo)
LOCAL loXmlHttp, lcResponse
clea
IF PCOUNT()<2
* Use sample data
tcDataToSend = "txtMyHtmlTextBox=sampledata"
tcUrlTOPostTo = "ENDIF

loXmlHttp = CREATEOBJECT("MSXML2.XMLHTTP")
* Set the connection. The parameters are the data transfer
* method, the URL to connect to
* and if we are connectiong asynhroniously
loXmlHttp.open("POST",tcUrlTOPostTo,.f.)
* Set the post's request header.
loXmlHttp.setrequestHeader("content-type", ;
"application/x-* THis command submits the data to the web form.
loXmlHttp.send(tcDataToSend)
lcResponse = loXmlHttp.responsetext

loXmlHttp = .null.
*?lcResponse
RETURN lcResponse



Regards
Dejan
 
Did you see faq184-4359 How To Programmatically Fill In a Form (HTTP GET/POST)?

Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top