I am trying to use facebook Graph API, to update a users staus message.
I am getting the following error while using it, I think the new graph sdk is not being properly referenced ?
Notice: Undefined property: Facebook::$api_client in /users/home/aafhe7vh/web/public/update.php on line 9
Fatal error: Call to a member function users_hasAppPermission() on a non-object in /users/home/aafhe7vh/web/public/update.php on line 9
This is the file I am using http://github.com/facebook/php-sdk/blob/master/src/facebook.php
Following is the content of my update.php:
# <?php
include_once ('facebook.php');
$api_key = '@@@@@@@@@@@@@@@@@@@2';
$secret = '$$$$$$$$$$$$$$$$$$$$44';
global $facebook;
$facebook = new Facebook($api_key, $secret);
# include_once("config.php");
# if (!$facebook->api_client->users_hasAppPermission("status_update")){
# echo '<fb:prompt-permission perms="status_update" next_fbjs="greet()">Let us update your status </fb:prompt-permission>';
# $visibility = "none";
# }
# else
# $visibility = "block";
#
# if(isset($_POST['hello']))
# {
# $facebook->api_client->users_setStatus($_POST['hello']);
# echo "<p>Your status has been updated</p>";
# }
# ?>
# <div id="statusdiv" style="display:<?=$visibility;?>;">
# <form method="POST">
# Please update your status:<br/>
# <input type="text" name="status" /> <br/>
# <input type="submit" value="change status" />
# </form>
# </div>
#
# <script>
#
function greet()
# {
# var session = "<?=$facebook->api_client->session_key;?>";
# document.getElementById("statusdiv").setStyle("display","block");
# new Dialog().showMessage("Info","Thank you for granting us this permission! ");
# }
</script>
I used the above code from here , http://fbcookbook.ofhas.in/tag/extended-permission/
I am not sure what the config.php should contain so I have removed that line in my code.
Thanks.