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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

any HTTP support ?? (new to this)

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
is there an HTTP support library with foxpro? i need to send a reqest to a remote servlet (that i don't own) in either XML form or as a FORM. this has to be done within foxpro and i must be able to recieve an XML file in return.

if there is no HTTP support does it allow socket programming so i could maybe try it manually.

any comments? even if you think this is impossible please say....

thanks,
fraser.
 
You could use the MicroSoft XMLHTTP object to retrieve XML from an URL.

ox = CREATEOBJECT('msxml2.xmlhttp') &&Comes with IE5
ox.open("OPEN", cUrl, .F., cLoginname, cPassword)

THis will open the connection.

ox.Send() will send the data.

oDomDocument = ox.responeXML()

The oDomDocument ('MSXML.DomDocument') is the object returned with which you can manipulate the XML retrieved.

Hope this will help you on your way.


Weedz (Wietze Veld) They cling emotionally to code and fix development rather than choosing practices based on analytical assesments of what works best. - Steve McConnell
 
thanyou very much for your time :)

with the ox.Send() call can this act just like a HTTP request? either POST with FORM data or to send XML data? that reminds me, the XML data would have to be sent via POST anyway ... i think.

thanks,
fraser.
 
The operand "GET" is the opposite of "POST", so if you want to post an XMl file to a cetain URL you will have to use "POST" iso "GET" in the open function.

In your ox.Send(), you would be sending the oDOMDocument object as a parameter.

So to give an expample:

- Already created an XML with the DomDocument object.
- ox.Open("POST", .F., cUrl, cLoginName, cPassWord)
- ox.send(oDomDocument)

So you will first have to create an XML file with your data (according to your XML schema), using the XML.DomDocument object and once created you can send it to the specific URL.

HTH,
Weedz (Wietze Veld) They cling emotionally to code and fix development rather than choosing practices based on analytical assesments of what works best. - Steve McConnell
 
Ooops, a typo...

ox.Open("POST", .F., cUrl, cLoginName, cPassWord)

this must be:

ox.Open("POST", cUrl, .F., cLoginName, cPassWord)

;-) Weedz (Wietze Veld) They cling emotionally to code and fix development rather than choosing practices based on analytical assesments of what works best. - Steve McConnell
 
thanks again.... :)

once i start to implement this i'll be back to pester you !!

regards,
fraser.
 
one last thing for now....when senging the XML data can i just assign it into a string like

data=&quot;<.....><.....><....>&quot;

and then use 'data' as the arguement for ox.send() ??

much appreciated!
fraser.
 
No, you will have to use the XML.DomDocument object to make your XML and send the DOMDocument object as parameter.

See for more info: Weedz (Wietze Veld) They cling emotionally to code and fix development rather than choosing practices based on analytical assesments of what works best. - Steve McConnell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top