Monday, August 23, 2010

Twitter with Powerbuilder

Inspired from this article, I trying to made a simple script to post to Twitter from Powerbuilder. All you need is msxml2.dll which located at c:\windows\system32.

And also, you need to create a Twitter's account. Using an OleObject object, try this simple script:


1:  Integer i  
2:  OleObject oleTwitter  
3:    
4:  OleTwitter = CREATE OLEObject  
5:    
6:  i = oleTwitter.ConnectToNewObject("Msxml2.XMLHTTP")  
7:    
8:  if i = 0 then  
9:       oleTwitter.Open("POST", "http://youraccount:yourpassword@twitter.com/statuses/update.xml?status=Just for #..., Twitt from Powerbuilder", False)  
10:       oleTwitter.setRequestHeader("Content-Type", "text/xml")  
11:       oleTwitter.Send()  
12:  else  
13:       MessageBox("Error","Cannot connect to Object"  
14:  end if  

Please beware, I don't give a guarantee for any security matters that will caused for your Twitter's account, since I don't have any deep experiences using the XML.

And this is the result:

No comments:

Post a Comment