With this method you can add friends of Twitter for one account Twitter.
<!--- friend to be added --->
<cfparam name="friend" default="" />
<cfif Len(Trim(friend))>
<!--- objects that will work on this pages --->
<cfset twitter = createObject('component','org.cftwitterlib.Twitter').init(application.usertwitter,application.passtwitter) />
<!--- it recovers one account twitter --->
<cfset friendAccount = deserializeJSON(twitter.showUser(friend)) />
<!--- it exhibits friend's information who is going to be added --->
<h1><cfoutput><img src="#friendAccount.profile_image_url#" /> #friendAccount.name# - #friend# (#friendAccount.followers_count#)</cfoutput> </h1>
<!--- it verifies tells her of the friend future is blocked --->
<cfif NOT friendAccount.protected>
<!--- it verifies we are already friends --->
<cfif NOT deserializeJSON(twitter.friendshipExists(application.usertwitter,friend)) >
<!--- it adds friend --->
<cfset follow = deserializeJSON(twitter.follow(friendAccount.id)) />
<b style="color:#090">it was added</b>
<cfelse>
<b style="color:#09F">it is already your friend</b>
</cfif>
<cfelse>
<b style="color:#F00">It is protected, for this reason it was not added</b>
</cfif>
</cfif>
<cfparam name="friend" default="" />
<cfif Len(Trim(friend))>
<!--- objects that will work on this pages --->
<cfset twitter = createObject('component','org.cftwitterlib.Twitter').init(application.usertwitter,application.passtwitter) />
<!--- it recovers one account twitter --->
<cfset friendAccount = deserializeJSON(twitter.showUser(friend)) />
<!--- it exhibits friend's information who is going to be added --->
<h1><cfoutput><img src="#friendAccount.profile_image_url#" /> #friendAccount.name# - #friend# (#friendAccount.followers_count#)</cfoutput> </h1>
<!--- it verifies tells her of the friend future is blocked --->
<cfif NOT friendAccount.protected>
<!--- it verifies we are already friends --->
<cfif NOT deserializeJSON(twitter.friendshipExists(application.usertwitter,friend)) >
<!--- it adds friend --->
<cfset follow = deserializeJSON(twitter.follow(friendAccount.id)) />
<b style="color:#090">it was added</b>
<cfelse>
<b style="color:#09F">it is already your friend</b>
</cfif>
<cfelse>
<b style="color:#F00">It is protected, for this reason it was not added</b>
</cfif>
</cfif>
public string follow(string id, [string format])
id = identifier of the user in Twitter (different from login)
format (optional, json is default) = xml, json
There are no trackbacks for this entry.
Trackback URL for this entry:
http://blog.pcsilva.com/en/trackback.cfm?CB611C77-C292-0404-032911EEF6299125
http://blog.pcsilva.com/en/trackback.cfm?CB611C77-C292-0404-032911EEF6299125










There are no comments for this entry.
[Add Comment] [Subscribe to Comments]