WinDev – Have some fun with Social Networks

by | Sep 5, 2008 | WinDev | 0 comments

tw Social Networks like Twitter are great fun when you are in the mood to create some little apps.

Here’s a simple example code to get some of my friends tweets. All I did was look through the Twitter API and picked out a simple REST method to get some XML back as a test.

Reading XML in WinDev is very simple using a few methods. I recommend you run the URL in a browser and return back some XML data you can then use to play with. That way you are not making lots of calls to the Twitter API (which is limited by design anyway).

sLine is string
iPos is int
sUrl is string = "http://www.twitter.com/statuses/friends/funcoder.xml"
ListDeleteAll(LIST_Results)
 
IF HTTPRequest(sUrl) THEN
    sResult is string = HTTPGetResult()
    
    XMLDocument("XMLDoc",sResult)
    
    XMLFind("XMLDoc","user",XMLChildItem)
    
    WHILE XMLFound("XMLDoc")
        IF XMLFind("XMLDoc","created_at", XMLElement) THEN
            sLine = XMLData("XMLDoc")
            
            IF XMLFind("XMLDoc","text",XMLElement) THEN
                sLine += " | " + XMLData("XMLDoc")
                
                IF sLine <> "" THEN
                    ListAdd(LIST_Results,sLine)
                END
            END
            
 
        END
        
 
        
        XMLFind("XMLDoc","user",XMLContinue)
    END
    XMLCancelSearch("XMLDoc")
    XMLClose("XMLDoc")
END

You can then move on to some further experiments and combine different social networks to create some unique mashups.

Spread the love