View Single Post
  #1 (permalink)  
Old October 14th, 2009, 12:16 PM
aspless aspless is offline
Friend of Wrox
Points: 489, Level: 7
Points: 489, Level: 7 Points: 489, Level: 7 Points: 489, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2006
Location: Berkshire, United Kingdom.
Posts: 104
Thanks: 9
Thanked 1 Time in 1 Post
Default Facebook api vs Twitter api

What i am interested to know is if anyone has successfully written a classic asp script to interface with facebook for simple status updates and maybe even facebooks internal messaging.

After the brief look around the net i am a tad over welmed by the seeming complexity of this task.

Compared to twitters querystring method there is much more involvement in getting the facebook api to talk.

In case any of you are interested in the twitter script below are two examples. The first is the status update script and the second is my re-written direct message script using the querystring from a .Net example (available if requested).

Status Update:

Code:
<%
'============================================================== 
' 
' Scriptname: PostToTwitterSimple.vbs 
' 
' SITEJUNCTION 
' TWITTER STATUS UPDATE 
' 
' With this script you can update your Twitter status 
' 
' July 2009 - Erick Hiemstra 
' 
' more info: 
' http://sitejunction.awardspace.com/v.../basic_script/ 
' 
'============================================================== 
OPTION EXPLICIT 'Be sure you have declared all your variables. 
' -------------------------- 
' SOME VARIABLES 
' In this script the response is hardcoded directly into a variable 
' to keep the script readable, but could of 
' course come from whatever source. 
' -------------------------- 
Dim strUsername, strPassword, strMessage 
strUsername = "your name here" ' Your Twitter username 
strPassword = "your password here" ' Your Twitter password 
strMessage = "Your update here" ' Your Twitter update
 
' Calling the function and store the result in a variable. 
Dim strTwitterXMLResponse 
strTwitterXMLResponse = SendToTwitter(strMessage, strUsername, strPassword) 
' Post back the result with a messagebox so you know something happend 
MsgBox strTwitterXMLResponse, VbOkOnly, "TWITTER STATUS UPDATE" 
' -------------------------- 
' FUNCTIONS 
' This is where the actual work is done 
' -------------------------- 
Function SendToTwitter(strMessage, strUsername, strPassword) 
     ' This is the function wicht does all the work. 
     ' It uses XMLHTTP to post your message to Twitter.. 
     Dim objHTTP 
     Set objHTTP = CreateObject("Microsoft.XMLHTTP") 
 
          objHTTP.open "POST", "http://twitter.com/statuses/update.xml", false, strUsername, strPassword 
          objHTTP.send "status=" & strMessage 
 
          ' The function stores the Twitter response to the result of the function so you can use this later 
          SendToTwitter = objHTTP.responseText 
 
     Set objHTTP = nothing 'Release the object 
 
End Function
%>

Last edited by aspless; October 14th, 2009 at 12:21 PM.
Reply With Quote