Calling http:// pages

Calling web pages in code
There are heaps of ways of doing this, but here's a very simple way if you just want to get html quickly


* Retrieve a URL SET SAFETY OFF LOCAL oXMLHTTP, cString, cURL, cFile cString = '' cURL = 'http://fox.wikis.com/wc.dll?Wiki~SydneyVFPUserGroup~VFP' cFile = ADDBS(JUSTPATH(SYS(16,1))) + 'geturlresults.html' TRY * create the XML object and open the URL link oXMLHTTP = CREATEOBJECT("Microsoft.XMLHTTP") oXMLHTTP.open( "GET", cURL, .F.) * Retrieve document oXMLHTTP.send() cString = oXMLHTTP.responseBody CATCH TO loError cString = ; [Error: ] + TRANSFORM(loError.ERRORNO) + CHR(13) + ; [Line: ] + TRANSFORM(loError.LINENO) + CHR(13) + ; [Message: ] + loError.MESSAGE + CHR(13) + ; [Procedure: ] + loError.PROCEDURE + CHR(13) + ; [Details: ] + loError.DETAILS + CHR(13) + ; [Contents: ] + loError.LINECONTENTS FINALLY RELEASE oXMLHTTP ENDTRY = STRTOFILE(cString, cFile)


Last Updated: 26/11/2005