quick update: sqwi.sh API is just about go-time

Just to say that the sqwi.sh API is built, and I’m just doing final testing over the next few days to make sure it is robust before launch.

More updates to come….

Advertisements

quick update: download your last 3200 tweets!!

Here’s a little script I found to download your last 3,200 tweets in one shot on a machine with curl installed.

curl -O -u username:password "https://twitter.com/statuses/user_timeline.xml?count=100&page=[1-32]"

Replace username and password as necessary. If your password has a special character like an exclamation point or an ampersand, you’ll have to put a backslash (\) before it.

Twitter only allows you to retrieve your last 3,200 tweets, but that’s better than nothing; and really most of us probably don’t have that many yet….

[Sourced from DCortesi.com, he makes tweetstats.com which is a very cool tool]

handling Twitter API response codes (cURL, PHP)

A quick switch structure in PHP for handling Twitter error codes when using the Twitter API.

<?php
$val = $resultArray['http_code'];
switch ($val) {
case "200":
echo "Tweet sent.";
break;
case "304":
echo "There was no new data to return.";
break;
case "400":
echo "The request was invalid."
break;
case "401":
echo "Invalid login credentials.";
break;
case "403":
echo "The request is understood, but it has been refused."; // An accompanying error message will explain why. This code is used when requests are being denied due to update limits.
break;
case "404":
echo "Invalid user name.";
break;
case "406":
echo "Not Acceptable."; //Returned by the Search API when an invalid format is specified in the request.
break;
case "500":
echo "Twitter internal server error.";
break;
case "502":
echo "Twitter is down or being upgraded.";
break;
case "503":
echo "The Twitter servers are up, but overloaded with requests. Try again later.";
break;
default:
echo "Communication error. Please try again.";
}
?>

This script can be used to handle the return codes from tweeting via cURL. Simply replace the

if ($resultArray['http_code'] == 200)
echo ‘Tweet Posted’;
else
echo ‘Could not post Tweet to Twitter right now. Try again later.’;

section of the tweeting script with the script from this post, and you’ll be sorted. Nothing much more to say, I couldn’t even think of comments for the script because it’s self-explanatory.