Hello everybody! How are you? I hope everything is well there :) Today I'd like to write a post about Fbcmd. Fbcmd is a command line interface (CLI) for Facebook which is open-source and works on Windows, Linux, and Mac. Fbcmd was originally created for "fast" status update and posting some items on news feed, but it has additional features too! In this post, we'll cover how to get Fbcmd running on Linux system, how to configure it and finally a simple example on how to post status update on Facebook with this cool stuff.
Installing required components
Fbcmd created with PHP programming language, so we need PHP interpreter to run this application:
Check whether everything is installed correctly by typing the following command:
- sudo apt-get install php5 php5-cli
Now, please make sure that PHP is configured correctly, especially "allow_url_fopen" variable in php.ini must be set to "On".
- php -r "echo phpversion();"
- cat /etc/php5/cli/php.ini | grep allow_url
If the value of "allow_url_fopen" is still "Off" set it to "On"!
Please download Fbcmd zipped package here, then type the following commands to install it:
It needs some times to install because it will search for update on the Internet. Once installed, please type "fbcmd" on Terminal the check wheter Fbcmd is installed correctly.
- unzip fbcmd.zip
- cd fbcmd
- sudo php fbcmd_update.php
- sudo php fbcmd_update.php install
The purpose of this step is to gain access to your Facebook account, so please be patient if there will a lot of commands to run. Don't worry, you should run this step only once!
Please make sure, you have logged into your Facebook account:
A window of web browser will be opened and you will be prompted to give "initial" permission to Fbcmd accessing your account (for Auth Code generation process). Now, Fbcmd needs to generate Auth Code (or One-time code) from your account, simply type the following command:
- fbcmd go access
A web browser window will be opened again and you need to "Generate" one-time code which will be entered to Fbcmd application in order to gain "full" access to your Facebook account. Please, generate the code and remember, copy, or save the unique code.
- fbcmd go auth
Once, One-time code successfully generated, run this command to enter it to the application:
Replace "XXXXXX" with your unique code. There is one more step to give Fbcmd "full" access to your Facebook account:
- fbcmd auth XXXXXX
You've done! Now you can use Fbcmd as you wish. I'll give an example on how to post status update using Fbcmd:
- fbcmd addperm
There are still a lot of commands of Fbcmd, you can read all of them including the examples here.
- fbcmd status "This is a test status update using Fbcmd"