You are here:

dk.ActiveXperts.com > Twitter Toolkit

ActiveXperts Twitter Toolkit

quicklinks


Tilføj Twitter muligheder og funktioner til dit Windows eller web applikation.

ActiveXperts Twitter Toolkit gør det muligt for alle Windows eller web-applikation til at integrere Twitter funktionalitet.

  • Nemt at bruge API
  • Send Tweets
  • Se forskellige tidslinjer
  • Find brugere og følg dem.
  • 32-bit ActiveX og 64-bit ActiveX inkluderet.
  • Prøver og demostrationer er tilgængelig i C#, VB, ASP.NET, HTML, PHP, Javascript, Delphi og mere
How to use Twitter toolkit Visual Studio.NET Web Application GUI Application Console Application
Startup screen MS Visual Studio .NET web Applikation .NET GUI Applikation Console Applikation

ActiveXperts Twitter Toolkit understøtter følgende:

  • Send dine tweets på Twitter ved hjælp af din egen software
  • Nemt at gennemse dine egne tweets eller Tweets på en anden tidslinje
  • Nemt at browse gennem venner og tilhængere
  • Integreret OAuth (Open Authorization) understøtter både klient og web-use cases
  • Godkend brugere i kun to API-kald
  • Adgang til alle de funktioner, som er offentligt tilgængelige på twitters REST-interface
  • Giver et grænseflade til at sende tilpassede, OAuth underskrevet, anmodninger til Twitter REST grænsefladen
  • ActiveXperts Twitter Toolkit er en ActiveX / COM komponent, der kan integreres i stort set alle Windows-udviklingsmiljø

System Krav

ActiveXperts Twitter Toolkit er tilgængelig som en 32-bit komponent og som en 64-bit komponent (begge en del af produktet):

  • TwitterTK.dll - 32-bit Komponent;
  • TwitterTKx64.dll - 64-bit Komponent.

ActiveXperts Twitter Toolkit kan køre på følgende operativsystemer:

  • Windows 2008 (32 og 64 bit);
  • Windows 2003 (32 og 64 bit);
  • Windows 2000 Server og Professional (32 bit only);
  • Windows 7 (32 og 64 bit);
  • Windows Vista (32 og 64 bit);
  • Windows XP (32 og 64 bit).

Code Snippets og Sample Applications (VBScript)

For de fleste af disse prøver, du skal have en kunde nøgle og en Access-nøgle. Brug denne wizard til at få både en forbruger nøgle og en Access-nøgle.

Følgende kodeeksempel illustrerer OAuth tilladelse til en klient program, der bruger Twitter Toolkit.

  Option Explicit

Dim objTwitter, objIE
Dim strUrl, strVerify

' Create the twitter object
Set objTwitter = CreateObject( "ActiveXperts.Twitter" )

' Set the consumer key
objTwitter.ConsumerKey = "..................."
objTwitter.ConsumerSecret = ".........................................."

' Request an authorization URL
strUrl = objTwitter.RequestAuthorization 
TestSuccess

' Navigate to the Authorization URL
Navigate strUrl

' While on the Authorization URL, ask the user to input the verification code
strVerify = inputbox( "Enter verification code", "Enter value", "" )

' Trade the verify token with an access token
objTwitter.RequestAccessToken strVerify
TestSuccess

' Tweet about our success !
objTwitter.Tweet "I'm Tweeting with ActiveXperts Twitter Toolkit !"
TestSuccess

' Print the access token so it can be used again.
WScript.Echo "Access token: " & objTwitter.AccessToken
WScript.Echo "Access token secret: " & objTwitter.AccessTokenSecret

' *************************************************************************************

' Navigate to a specific URL
Function Navigate( strUrl )
  Set objIE = CreateObject("InternetExplorer.Application")
  
  objIE.Navigate strUrl 
  objIE.Visible = 1

  Do While objIE.Busy
  Loop
End Function

' Test if a function call on the Twitter Toolkit object succeeded
Function TestSuccess()
  Dim strDescription
  
  If objTwitter.LastError <> 0 Then
    strDescription = objTwitter.GetErrorDescription(objTwitter.LastError)
    WScript.Echo "Failed, error: " & objTwitter.LastError & "; " & strDescription
    WScript.Quit 1
  End If
End Function

List your home time-line

  Option Explicit    
  
Dim objTwitter, objTweet, objUser

' Create the twitter object
Set objTwitter = CreateObject( "ActiveXperts.Twitter" )

' Set the consumer key
objTwitter.ConsumerKey = "..................."
objTwitter.ConsumerSecret = ".........................................."

' Set the user key
objTwitter.AccessToken = ".................................................."
objTwitter.AccessTokenSecret = ".........................................."

' List tweets and the users who posted them
' The tweets are from a specific time-line. The following time-lines are possible:
' "public", "home", "friends", "mentions", "retweeted_by_me", "retweeted_to_me", 
' "retweeted_of_me" or either a user id or screen name
Set objTweet = objTwitter.FindFirstTweet("home")
While objTwitter.LastError = 0
  WScript.Echo "Id: " & objTweet.Id
  WScript.Echo "Created at: " & objTweet.CreatedAt
  WScript.Echo "Text: " & objTweet.Text
  WScript.Echo "Source: " & objTweet.Source
  Set objUser = objTweet.User
  WScript.Echo "By:"
  WScript.Echo vbTab & "Id: " & objUser.Id
  WScript.Echo vbTab & "Created at: " & objUser.CreatedAt
  WScript.Echo vbTab & "Name: " & objUser.Name
  WScript.Echo vbTab & "Screen name: " & objUser.ScreenName
  WScript.Echo vbTab & "Location: " & objUser.Location
  WScript.Echo vbTab & "Description: " & objUser.Description
  WScript.Echo vbTab & "Profile image: " & objUser.ProfileImage
  WScript.Echo vbTab & "URL: " & objUser.URL
  WScript.Echo vbTab & "Protected: " & objUser.Protected
  WScript.Echo vbTab & "Followers: " & objUser.NumFollowers
  WScript.Echo vbTab & "Friends: " & objUser.NumFriends
  WScript.Echo vbTab & "Tweets: " & objUser.NumTweets  
  Set objTweet = objTwitter.FindNextTweet
WEnd

List your followers

  Option Explicit

Dim objTwitter, objStatus, objUser

' Create the twitter object
Set objTwitter = CreateObject( "ActiveXperts.Twitter" )

' Set the consumer key
objTwitter.ConsumerKey = "..................."
objTwitter.ConsumerSecret = ".........................................."

' Set the user key
objTwitter.AccessToken = ".................................................."
objTwitter.AccessTokenSecret = ".........................................."

' Get all of your followers
Set objUser = objTwitter.FindFirstFollower
While objTwitter.LastError = 0
WScript.Echo "--"
WScript.Echo "Id: " & objUser.Id
WScript.Echo "Created at: " & objUser.CreatedAt
WScript.Echo "Name: " & objUser.Name
WScript.Echo "Screen name: " & objUser.ScreenName
WScript.Echo "Location: " & objUser.Location
WScript.Echo "Description: " & objUser.Description
WScript.Echo "Profile image: " & objUser.ProfileImage
WScript.Echo "URL: " & objUser.URL
WScript.Echo "Protected: " & objUser.Protected
WScript.Echo "Followers: " & objUser.NumFollowers
WScript.Echo "Friends: " & objUser.NumFriends
WScript.Echo "Tweets: " & objUser.NumTweets
Set objUser = objTwitter.FindNextUser
Wend

Make a custom API call

  Option Explicit

Dim objTwitter, objXML, objNodeList, strResult, i

' Create the twitter object and an XMLDOM object
Set objTwitter = CreateObject( "ActiveXperts.Twitter" )
Set objXML = CreateObject( "Microsoft.XMLDOM" )

' Set the consumer key
objTwitter.ConsumerKey = "..................."
objTwitter.ConsumerSecret = ".........................................."

' Set the user key
objTwitter.AccessToken = ".................................................."
objTwitter.AccessTokenSecret = ".........................................."

' Make a custom API call
strResult = objTwitter.APICall("statuses/home_timeline", "xml")

' Display the results
objXML.LoadXML(strResult)
Set objNodeList = objXML.selectNodes("//statuses/status/text")
For i = 0 To objNodeList.length
WScript.Echo objNodeList(i).text
Next