Sep 16, 2008

Update Facebook status through Bash, using cURL

anger management part 2 peeps!

A nice simple bash script to update the status on facebook from the command line. Pretty straight forward, using cURL here again. As usual, edit the email and passord. Script takes one argument, the status. There's no error-checking so there really isn't a way to know if it was successful or not. I'll add that in sometime later.

I love cURL!

edit: some installation instructions for the younger peeps
1) copy past it into a new file on the desktop say fbupdater
2) open terminal, type "sudo cp /Desktop/fbupdater /usr/local/bin/fbupdater"
3) type "chmod a+x /usr/local/bin/fbupdater"

and that should do it.




cd $HOME

echo "logging in"

pfID=`curl -L --silent -A "MOZILLA/5.0" -b cookie -c cookie -d "email=${email}" \
-d "pass=${pass}" -d "login=Log+In" | \
sed -nr 's/.*post_form_id" value="(\w+)".*/\1/p'`

echo "updating"
curl --silent -L -A "MOZILLA/5.0" -b cookie -c cookie -d "post_form_id=${pfID}" \
-d "status=${stat}" -d "update=Update" > /dev/null

if [ -e cookie ]
rm cookie
echo "no cookie file? something went wrong?"


Anonymous said...

Doesn't work with the new Facebook.

Vivek said...

Dosent work.
Can you post an update.

SoE said...

I would recommend using FBCMD for all command line interaction with facebook.

bozie said...

:bump: how can haz updates with teh command lines?

SoE said...


Anonymous said...

There is a new script for that:

suman said...

doesnt work mate

SoE said...

This was posted ages ago. Facebook has undergone some significant changes since then.

Anonymous said...

Post a Comment