Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/php
- <?php
- // IMPORTANT! READ THE FOLLOWING NOTES:
- //
- // This is a VERY stripped version of FBCMD by Dave Tomkins
- // It will NOT work unless you properly install his application
- // His application's homepage is http://fbcmd.dtompkins.com/
- //
- // The .libfb.php file is a merged version of all the Facebook API files
- // It can be downloaded at http://pastebin.com/f316e87b7
- //
- // This is just a heavily stripped down version of FBCMD
- // I did not really write this code -- just modified someone else's
- include_once('.libfb.php');
- $fbCmdVersion = '0.96';
- $GLOBALS['facebook_config']['debug']=false;
- $fbCmdAppKey = 'd96ea311638cf65f04b33c87eacf371e'; // FBCMD's app key (don't touch)
- $fbCmdAppSecret = '88af69b7ab8d437bff783328781be79b'; // FBCMD's secret (don't touch)
- $fbCmdUserSessionKey = ''; // sessionskey.txt Line 1 (use FBCMD with AUTH command to generate)
- $fbCmdUserSecretKey = ''; // sessionskey.txt Line 2 (ditto)
- try {
- $fbObject = new FacebookDesktop($fbCmdAppKey, $fbCmdAppSecret);
- $fbObject->api_client->session_key = $fbCmdUserSessionKey;
- $fbObject->secret = $fbCmdUserSecretKey;
- $fbObject->api_client->secret = $fbCmdUserSecretKey;
- $fbUser = $fbObject->api_client->call_method('facebook.users.getLoggedInUser', array());
- } catch (Exception $e) {
- FbCmdException('Could not use session key / log in user',$e);
- }
- try { $fbObject->api_client->call_method('facebook.users.setStatus',array('status' => $argv[1],'status_includes_verb' => true)); }
- catch(Exception $e) {
- if ($e->getCode() == 250) { FbCmdFatalError("STATUS requires special permissions:\n\nvisit the website:\n\nhttp://www.facebook.com/authorize.php?api_key={$fbCmdAppKey}&v=1.0&ext_perm=status_update\n\nor http://tinyurl.com/fbcmd-status\n\nto grant permissions\n"); }
- else { FbCmdException('STATUS',$e); }
- }
- function FbCmdFatalError($err) { global $fbCmdVersion; die("\nfbcmd [v{$fbCmdVersion}] ERROR: {$err}\n"); }
- function FbCmdException($cmd,Exception $e) { FbCmdFatalError("{$cmd}\n[{$e->getCode()}] {$e->getMessage()}"); }
- ?>
Add Comment
Please, Sign In to add comment