You are here:
ActiveXperts.com > Twitter Toolkit > How to Use ActiveXperts Twitter Toolkit > ASP 2.x
Quicklinks
Twitter is a popular social networking service that enables its users to send and read messages called Tweets. Tweets are text-based posts of up to 140 characters. They are displayed on the author's profile page.
Twitter users can send and receive tweets through the Twitter website or through compatible applications. Applications that want to send or receive Tweets have the option of using Twitters HTTP based RESTfull API. The ActiveXperts Twitter Toolkit provides a user friendly wrapper around Twitters own HTTP based API.
The ActiveXperts Twitter API supports the following:
This tutorial describes how the Twitter Toolkit can be integrated into ASP projects.
Download the Twitter Toolkit from the ActiveXperts web site and start the installation. The installation guides you through the installation process. Download now »
First, create a new directory on the IIS Server's file system. This directory will hold the ASP later on.
From the 'Start menu', click on 'Administrative Tools' and click on 'Internet Information Services (IIS) Manager'. Right-click on the 'Web Sites' container and choose 'New->Web Site':
(Click on the picture to enlarge)
The 'Web Site Creation Wizard' is shown, guiding you through the process of creating a new web site. Provide all necessary information:
You're now able to write an ASP script to send and receive SMS messages using the Twitter Toolkit.
Create a new ASP script called DEFAULT.ASP in the directory that was created in Step2, using your favorite editor. On top of the ASP code, insert the following lines to declare and create the SMS objects:
<object runat=server progid="ActiveXperts.Twitter" id=objTwitter ></object>
Insert the following lines to declare and create the Twitter object:
Now, test if your new web site is working well with the Twitter Toolkit using your browser. If you are using Microsoft Internet Explorer, it is recommended to disable friendly error message because this default setting doesn't show any ASP error message, making it hard to debug if there are any problems:
The following code shows how to tweet a message using ASP
<object runat="server" progid="ActiveXperts.Twitter" id="objTwitter"> </object>
<html>
<head>
<title>ActiveXperts Twitter Sample</title>
<style>
.clbody {
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:9pt;
font-weight:normal;
}
.clfooter {
font-family:Verdana;
font-size:7pt;
font-weight:normal;
}
h1, .h1 {
width:100%;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:18px;
font-weight:bold;
}
hr, .hr {
color:#b0b0b0;
}
</style>
</head>
<body class="clbody">
<h1>ActiveXperts Twitter Sample</h1>
<hr size="1">
<div style="width:800px">
In this sample you need to have a consumer key and an access key.
</div>
<hr size="1">
<br>
<%
Dim numLastError, strLastError
numLastError = 0
strLastError = ""
If Request( "CTL_TWEET" ) <> "" Then
objTwitter.LoadConsumerKey Request( "CTL_CONSUMERKEYFILE" )
numLastError = objTwitter.LastError
If numLastError = 0 Then
objTwitter.LoadAccesskey Request( "CTL_ACCESSKEYFILE" )
End If
If( numLastError = 0 ) then
objTwitter.Tweet Request( "CTL_MESSAGE" )
End If
strLastError = objTwitter.GetErrorDescription( numLastError )
End If
%>
<form action="default.asp" method="post">
<table class ="clbody" width="800">
<tr>
<td width="200" valign="top">ActiveXperts Twitter Toolkit:</td>
<td width="600" valign="top">Build: <% = objTwitter.Build %>;</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td valign="top">Consumer Key:</td>
<td valign="top"><input size="80" type="text" name="CTL_CONSUMERKEYFILE" value=""></td>
</tr>
<tr>
<td valign="top">Access Key:</td>
<td valign="top"><input size="80" type="text" name="CTL_ACCESSKEYFILE" value=""></td>
</tr>
<tr>
<td valign="top">Tweet:</td>
<td valign="top"><input size="80" type="text" name="CTL_MESSAGE" value=""></td>
</tr>
<tr>
<td valign="top"> xyz</td>
<td valign="top"><input size="80" type="submit" value="Tweet" name="CTL_TWEET"></td>
</tr>
<tr>
<td valign="top"> </td>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top">Result code:</td>
<td valign="top"><b><% = numLastError %>: <% = strLastError%></b></td>
</tr>
</table>
<br>
<br>
</form>
</body>
</html>
There are many working samples included with the product. You can also find them on the ActiveXperts FTP site: ftp.activexperts-labs.com/samples/twitter-component
The Twitter Toolkit can be used by any of the following operating systems: