Categories
Python

Python CLI App to update friendfeed: My way

I wrote a python CLI program to use the mobile friendfeed publisher at https://masnun.com/ff/.

It just posts the credentials to the mobile page, then the mobile page makes the update to friendfeed.

Source: http://myfriendfeed.googlecode.com/files/friendfeed.py

Categories
Python

Python: CLI App to update Twitter status

In my previous post, I have published the source codes to build a CLI php app to update your twitter status. Here comes the Python version…. It’s been a pain… took me 15 long minutes to cook it… I was having trouble with the basic authorization twitter requires. I am using Python 3 and had to make the basic auth credentials encoded into binary, base64 encode the binary and then decode the returned binary back into a string before I could use it to authorize :(.

Finally, it’s done and I am very much delighted with it… It asks for your username, password and finally the status when run. Feed it the information and it’ll do the job for you…

Thanks to Python… Ireally love it 🙂

Categories
PHP

Updating Twitter status using PHP CLI

Here’s the source file :

<?php
$username = $argv[1];
$password = $argv[2];
$message = $argv[3];
$tweetUrl = “http://{$username}:{$password}@www.twitter.com/statuses/update.xml”;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $tweetUrl);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, “status={$message}”);
$result = curl_exec($curl);
?>

How to Use ?
Save the file as “twitter.php”.

php twitter.php twitter_username twitter_password “Status Update !!”

NB: If you are posting a multi word status ( which has space ), don’t forget to wrap the sentence inside double quotes. Otherwise the first word of the sentence will be posted alone. The codes require cURL extension loaded.