Is there a way to fetch my latest tweet in plain-text form using javascript?
I was going to use fsockopen(), but my host does not have that enabled.

Dolphin,

The twitter API provides for this.

Try the following:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Airshow :: Untitled</title>
<style type="text/css">
body {
	background-color: #e0e0e0;
}
/* ul container */
#twitter_update_list {
	margin: 0;
	padding: 0;
	list-style-type: none;
}

/* a single line entry */
#twitter_update_list li {
	margin-bottom: 2px;
	padding: 3px 10px;
	background-color: #99ccff;
	border-width: 1px;
	border-style: solid;
	border-top-color: #cceeff;
	border-left-color: #cceeff;
	border-right-color: #003366;
	border-bottom-color: #003366;
}

/* the tweet itself */
#twitter_update_list li span {
	color: #003366;
	font-size: 10px;
	font-family: verdana;
	letter-spacing: 0.1em;
}

/* the tweet link */
/* by default it has font-size:85% */
#twitter_update_list li a {
	font-size: 9px;
	letter-spacing: 0;
}
</style>

<script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>

</head>

<body>

<h1>My Latest Tweets</h1>
<ul id="twitter_update_list">
<li>Loading Tweets ...</li>
</ul>

<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/yourTwitterUserName.json?callback=twitterCallback2&count=5"></script>
<!-- Change count value for the number of tweets you require. -->

</body>
</html>

Airshow

Dolphin,

The twitter API provides for this.

Try the following:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Airshow :: Untitled</title>
<style type="text/css">
body {
	background-color: #e0e0e0;
}
/* ul container */
#twitter_update_list {
	margin: 0;
	padding: 0;
	list-style-type: none;
}

/* a single line entry */
#twitter_update_list li {
	margin-bottom: 2px;
	padding: 3px 10px;
	background-color: #99ccff;
	border-width: 1px;
	border-style: solid;
	border-top-color: #cceeff;
	border-left-color: #cceeff;
	border-right-color: #003366;
	border-bottom-color: #003366;
}

/* the tweet itself */
#twitter_update_list li span {
	color: #003366;
	font-size: 10px;
	font-family: verdana;
	letter-spacing: 0.1em;
}

/* the tweet link */
/* by default it has font-size:85% */
#twitter_update_list li a {
	font-size: 9px;
	letter-spacing: 0;
}
</style>

<script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>

</head>

<body>

<h1>My Latest Tweets</h1>
<ul id="twitter_update_list">
<li>Loading Tweets ...</li>
</ul>

<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/yourTwitterUserName.json?callback=twitterCallback2&count=5"></script>
<!-- Change count value for the number of tweets you require. -->

</body>
</html>

Airshow

ah!
thanks!
works perfectly!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.