Wiki Home

Vfp Rss Consumer


Namespace: People
Here is some VFP code that consumes an RSS feed.

It is very new.

* getRSS.prg
* By Carl Karsten

Local ;
	oWebUtils, ;
	lcXML, ;
	lcPage

Clear

oWebUtils = CreateObject( "WebUtils" )

lcXML = oWebUtils.GetURL( "http://chicago.craigslist.org/car/index.rss" )
Xmltocursor( lcXML )
Scan for type="text"
	? link, title 
	lcPage = oWebUtils.GetURL( link )
	?? Len( lcPage )
EndScan

Return

Define Class WebUtils as Custom

	oXMLHttp = null && As MSXML2.XMLHTTP40

	Procedure Init
		This.oXMLHttp = Createobject( "MSXML2.XMLHTTP.4.0" )
		Return

	Procedure GetUrl
		Lparameters ;
			tcURL

		Local ;
			lcResponse
			
		this.oXMLHttp.Open( "GET", tcURL )
		this.oXMLHttp.Send()
		Do While this.oXMLHttp.readyState <4
		Enddo
		lcResponse = this.oXMLHttp.responseText

		Return lcResponse
	Endproc
Enddefine


Contributors Carl Karsten
( Topic last updated: 2006.01.22 11:34:12 AM )