If you're using Classic ASP but want to use Abraham Williams' PHP Oauth Library for sending Twitter status updates, here is one way to make it work.

Classic ASP Active Server Pages Examples, code, tutorials, scriptsUse Abraham Williams' PHP Twitter Oauth Library with Classic ASP

I had planned to use Scott Desapio's Classic ASP Twitter Oauth Library with my Classic ASP scripts, but recently, have been getting a signature error. So, I decided to find a way to use the Abraham Williams Library with my Classic ASP scripts instead. This example shows how you can trigger the PHP update script with an iframe in a Classic ASP script. Possibly, you could do the same thing by linking the PHP script via Ajax; that should work, but I haven't tried it. I decided to go with an iframe because I thought it might be more reliable than Ajax?

Although the example on this page uses an iframe, another method, if you have access to an account that can run cron jobs, would be to set it up as a cron job.

NOTE: The Twitter development team discontinued supporting basic authentication in mid August 2010.

Tutorial on registering an app with Twitter

First, download a copy of Abraham William's PHP Twitter Oauth Library at http://github.com/abraham/twitteroauth

Upload those files to your website. CAUTION: Running the "test.php" file WILL OVERWRITE many of your twitter account's settings!!! Use a test account or comment out everything you do not want the test.php script to do or do not run test.php at all.

Next, open config.php to make the following changes:

* @file
* A single location to store configuration.
//These values can be found in your application control panel on Twitter where you have registered your application


//you will need to define the following in your application control panel at twitter
define('OAUTH_CALLBACK', 'http://www.URL_OF_CALLBACK_FILE_HERE/callback.php');


Next, open the Classic ASP file that will be used to trigger your PHP Twitter Update script. Make an iframe in it. If you like, you can make the iframe just 1 pixel in size, so it is virtually invisible. I chose to make mine large enough to display the most recent status update after sending an update.


<div align="center">

Please pause to allow a status update to be sent to Twitter that announces your new ad below:
<table border="0" width="100%">
<p align="center">


'we set a cookie that the PHP file will check for, so as not to ping Twitter unnecessarily, thereby using up our allotment of hits for the hour


<iframe name="Twitter" src="twitterupdate.php" width="720" height="215" marginwidth="1" marginheight="1" scrolling="no" border="0" frameborder="0"></iframe></td>
If you see a status update above that is about your new ad, then our work here is complete and you may leave this page. :)



Please leave this credit with the code.
Use php twitter oauth status updates with classic asp by Lil Peck.

//the following function autolinks urls

NAME : autolink()
AUTHOR : J de Silva
DESCRIPTION : returns VOID; handles converting
URLs into clickable links off a string.
TYPE : functions

function autolink( &$text, $target='_blank', $nofollow=true )
// grab anything that looks like a URL...
$urls = _autolink_find_URLS( $text );
if( !empty($urls) ) // i.e. there were some URLS found in the text
array_walk( $urls, '_autolink_create_html_tags', array('target'=>$target, 'nofollow'=>$nofollow) );
$text = strtr( $text, $urls );

function _autolink_find_URLS( $text )
// build the patterns
$scheme = '(http:\/\/|https:\/\/)';
$www = 'www\.';
$ip = '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
$subdomain = '[-a-z0-9_]+\.';
$name = '[a-z][-a-z0-9]+\.';
$tld = '[a-z]+(\.[a-z]{2,2})?';
$the_rest = '\/?[a-z0-9._\/~#&=;%+?-]+[a-z0-9\/#=?]{1,1}';
$pattern = "$scheme?(?(1)($ip|($subdomain)?$name$tld)|($www$name$tld))$the_rest";

$pattern = '/'.$pattern.'/is';
$c = preg_match_all( $pattern, $text, $m );
unset( $text, $scheme, $www, $ip, $subdomain, $name, $tld, $the_rest, $pattern );
if( $c )
return( array_flip($m[0]) );
return( array() );

function _autolink_create_html_tags( &$value, $key, $other=null )
$target = $nofollow = null;
if( is_array($other) )
$target = ( $other['target'] ? " target=\"$other[target]\"" : null );
// see: http://www.google.com/googleblog/2005/01/preventing-comment-spam.html
$nofollow = ( $other['nofollow'] ? ' rel="nofollow"' : null );
$value = "<a href=\"$key\"$target$nofollow>$key</a>";



//First let's see if there is a cookie that was made by the page that has the referring iframe:
if ($_COOKIE['NewAdOK']=="NewAd") {

//if the cookie exists then we query the database for a new item to tweet about.
//create an instance of the ADO connection object
$Hconn = new COM ("ADODB.Connection")
or die("Cannot start ADO");

//define connection string, specify database driver
$connStr = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source= C:\\path_to_access_database\yourdatabase.mdb";

$Hconn->open($connStr); //Open the connection to the database

//declare the SQL statement that will query the database

//the following query could be used to filter for record id passed by the iframe link.
//$query = "SELECT TOP 1 TinyURL,BREED FROM HORSE_DATA where ID="&request.querystring("record_id")&" ORDER BY ID DESC";

//execute the SQL statement and return a single record
$rs = $Hconn->execute($query);

$rs = $Hconn->execute($query);

$TinyURL =$rs['TinyURL];
$TinyURL =(string)$TinyURL;

$HorseBreed =$rs['BREED'];
$HorseBreed =(string)$HorseBreed;

$statusUpdate="A new ".$HorseBreed." for sale has been posted: ".$TinyURL;

//close the connection and recordset objects freeing up resources

$rs = null;
$Hconn = null;

echo $statusUpdate;


//now we do the work to send a status update to Twitter, using Abraham Williams' Twitter Oauth Library

/* Load required lib files. */

$_SESSION['access_token'] = 'YOUR_APPLICATION_ACCESS_TOKEN'; // store session data
$_SESSION['oauth_token_secret'] = 'YOUR_APPLICATION_ACCESS_TOKEN_SECRET'; // store session data

/* If access tokens are not available redirect to connect page. */
if (empty($_SESSION['access_token']) ||
empty($_SESSION['access_token']['oauth_token']) ||
empty($_SESSION['access_token']['oauth_token_secret'])) {
header('Location: ./clearsessions.php');
/* Get user access tokens out of the session. */
$access_token = $_SESSION['access_token'];

/* Create a TwitterOauth object with consumer/user tokens. */

//the following can be left unchanged as is
function getConnectionWithAccessToken($oauth_token, $oauth_token_secret) {
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
$oauth_token, $oauth_token_secret);
return $connection;

//replace the following with codes from your application twitter control panel also

/* Get logged in user to help with tests. */
$user = $connection->get('account/verify_credentials');

$active = TRUE;

function twitteroauth_row($method, $response, $http_code, $parameters = '') {

if (!is_string($response)) {
$response = print_r($response, TRUE);
if (!is_string($parameters)) {
$parameters = print_r($parameters, TRUE);


/* statuses/update */
//$statusUpdate from the data we got out of our database previously
$parameters = array('status' => $statusUpdate);
$status = $connection->post('statuses/update', $parameters);
twitteroauth_row('statuses/update', $status, $connection->http_code,


else {
print "You are not logged in.<br>";


//now we check to make sure we have enough hits left in our allotment so as not to exceed our rate limit: 50 is the arbitrary number I chose
$json = file_get_contents("http://api.twitter.com/1/account/rate_limit_status.json", true);
$decode = json_decode($json, true);
$HowManyHitsLeft = $decode['remaining_hits'];

if ($HowManyHitsLeft > 50) {

//now we will display your most recent Tweet which should be the new one just submitted above
$json = file_get_contents("http://twitter.com/status/user_timeline/YOUR_TWITTER_ACCOUNT_USER_ID_NUMBER.json?count=1", true);
$decode = json_decode($json, true);

//echo "<pre>";
$count = count($decode); //counting the number of status
$NewStatus = $decode[$i][text]."<br>";

// here we are using the Silva autolink function from above to make the $TinyURL into a clickable link

autolink( $NewStatus );
// display the text in a web page
echo $NewStatus."<br />\r\n";


else {
echo "I am sorry, I am unable to show you the latest Tweet at this time.";



ASP Examples Menu of Active Server Pages scripts code Classic ASP

Classic ASP Active Server Pages Examples, code, tutorials, scriptsASP Examples Menu (below*)

Active Server Pages | ASP | Scripts | Tutorials | Code | Web Programming | Examples
Active Server Pages ASP code examples, tutorials, and snippets for use in Programming interactive websites.

If you find omissions or errors let me know. I have moved these code samples to their own domain; if you find pieces missing, please let me know.
My favorite scripts site is CODANGO.


If any the information I've posted here has been useful to you, please donate.

Quick 'n  easy  dirty PHP script code wizard-generator

Zenphoto RSS XML feed used as data source for javascript slide show with PHP

Classic ASP to archive emails into database and save attached files to folder

PHP Image GD for thumbnails and image resizing with pathing for Windows servers

ODBC database connections for Microsoft Access MDB files with Windows 7: solution posted on this forum.

HTML5 embedded video player "Projekktor" completely skinnable with hyperlinked watermark

Edit web.config to allow Windows iis7 server to handle mp4 files or other mime types as needed

URL rewrite or make friendly URLs for iis7 Windows Server 2008 by editing your web.config file


Use PHP to zip folders for backing up a website

Use PHP to archive emails in database and save attached files to folder

Use PHP with json to check how many hits left on Twitter API

PHP get single record from Access database without catchable fatal error message

PHP to make a bot to send automatic Twitter status updates with Abraham Williams' PHP Oauth Twitter Library

A way to use the PHP Oauth Twitter Library with your Classic ASP scripts for sending status updates

Get user's IP address location for your form results

Tutorial for registering an application with Twitter

Update your Twitter status with Classic ASP and Oauth seamlessly and invisibly without having to login to Twitter. Send status updates programmatically from a web page. PHP example too.

CLASSIC ASP: Cache your Twitter tweets in a database to keep your Twitter xml requests within the rate limit of 350 per hour / PHP VERSION

PHP: Use json to fetch Twitter followers' profiles

Index files content and insert into database for faster searches

Classic ASP with Ajax: secure URL check

Classic ASP with Ajax: referer check

Classic ASP with Ajax: a solution to the ampersand problem in querystrings

Very Simple Star Rating System for Classic ASP

Star Rating System uses CSS and JS adapated for Classic ASP from Yvo Schaap PHP script

XMLhttp with ASP to fetch and save photos from Photobucket account through RSS XML. Can be adapted for Youtube videos to import data to database.

NET image resize can be used to make thumbnails for Classic ASP

Track site visitors, get their ip address geographical data, count page views with Classic ASP

Javascript slideshow with Classic ASP to load image details dynamically from database photos table

Classic ASP with Ajax for rotating banners without page refresh and XML file converted to recordset as banner database
--Variation of the above but fetching a REMOTE XML file as the database
--Variation checks for secure URL and builds absolute URL and makes offsite banner links open in new window

True inline edit Classic ASP datagrid table database edit updating with Ajax SIMPLE EASY without page refresh!

Use Ajax with Classic ASP to preview data then update form with javascript url write

Yvo Schaap's easy inline edit Ajax: an example of using it to inline edit multiple rows of records in Classic ASP

Use Classic ASP to send text messages SMS from your website (Also shows how to use xmlhttp to post form data)

Ajax with Classic ASP for seamless, no page reload database record insertion

Nested SQL Statements to make temporary column names

Multiple records per row with paging

Display multiple records per row

Get ID of newly inserted record, Classic ASP, Access Database

Javascript timer with ASP to keep track of time expired until login expires / timeout session is up

Multiple Javascript event functions triggered from single form onsubmit

Get Querystring key names along with querystring variables

These are out of date but may still be of interest:

ASP Youtube Downloader  Version FOUR
All ASP code. Allows user client side downloads of Youtube videos. You have the option to allow files to be saved directly to your site also.
ASP/PHP video downloader (Works better than ASP for large files)

Use ASP to dynamically parse a Youtube XML playlist to render to html.

Zip up an archive file of your site for backup if you need to restore website with ASP and free Zip Component.

Zip all files in a folder into an archive or backup file dynamically by specific file extension.

Sanitize or clean price cost field for database insertion or display.

Javascript image dimensions and image file size preview.

Put recordset into array, assign keys to the records then use record associated with specific array key as a variable elsewhere.

Access Database Interface Generator Wizard to read your table and field names and to create a table display.

Combining dropdown selection box menu with dynamic ASP database page.

How to redirect user to original page they tried to view before logging, after they are logged in.

Previous/Current/Next Records, or Buddy Ring Script

Custom ASP 404 page not found error script: can also be used for URL rewriting

ASP Example: Combine ASP with Javascript for popup windows
dynamically sized to image dimensions.

ASP Example: How to use ASPJPEG to create thumbnails
Click for free Highly recommended thumbnailer for which you don't need Server access (doesn't seem to work on Windows Server 2008)

ASPjpeg: How to re-scale aspect ratio of thumbnails by height instead of width.

ASP Example: What if your host has an older version of ASPJPEG that doesn't support gifs?

Select Count Distinct Records for Access Database

Upload Image to folder and insert filename into database

Get date in such a way that it can be made part of a file name

Isolate a file name away from its path or extension or strip a path from a file name or strip characters from database field

User-customized on-the-fly stylesheet css files

Enhanced Page Hits Counter (also counts downloads and menu link hits)

Loop through array and compare to string with select case

Aphabetical Paging for your ASP scripts

Web Wiz Guide's Site Searcher Script modified as a file content indexer

Let Users Select How Many Records to View

Access Database for your PayPal IPN scripts

Miscellaneous collected code

From Classic ASP to PHP

You don't have to be a genius, just persistent, to write original Active Server Pages scripts

BuildApp - great old Classic ASP script generator!

Software Recommendation: bare_bones_no_bells_and_whistles_asp_code_generator_database_interface_maker (For PHP I recommend EasyGen.)

If any of this information is helpful to you, please consider donating with the button below. Thanks! ~~Lil