stealthrt Posted February 16, 2014 Share Posted February 16, 2014 (edited) Hey all i am using the following code to post to a posting on my news feed: <?php require '../src/facebook.php'; $facebook = new Facebook(array( 'appId' => 'xxxxxxxxxxxxxxx', 'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'fileUpload' => true, 'cookie' => true )); $user = $facebook->getUser(); if ($user) { try { $access_token = $facebook->getAccessToken(); $user_profile = $facebook->api('/me'); $comment = $facebook->api('/xxxxxxxxxxxxxx/comments', 'POST', array( 'access_token' => $access_token, 'message' => 'testing!' ) ); } catch (FacebookApiException $e) { echo ($e); $user = null; } } <?php if ($user): ?> <a href="<?php echo $logoutUrl; ?>">Logout</a> <?php else: ?> <a href="<?php echo $loginUrl; ?>">Login with Facebook</a> <?php endif ?> if ($user) { $logoutUrl = $facebook->getLogoutUrl(); } else { $statusUrl = $facebook->getLoginStatusUrl(); $params = array( 'scope' => 'read_stream, friends_likes, email, read_mailbox, read_requests, user_online_presence, friends_online_presence, manage_notifications, publish_actions, publish_stream, user_likes, user_photos, user_status, user_videos, read_insights' ); $loginUrl = $facebook->getLoginUrl($params); } ?> <?php print_r($user_profile); ?> For some reason i get this error: OAuthException: (#221) Photo not visible And i have no idea since i am posting a text comment and not even an image?? If i comment out the code line /*$comment = $facebook->api('/xxxxxxxxxxxxxx/comments', 'POST', array( 'access_token' => $access_token, 'message' => 'testing!' ) );*/ it works just fine (as in, displays my info with user_profile). I've tried reading over the page that tells you how to use the comments https://developers.facebook.com/docs/graph-api/reference/object/comments/ and i do - it just doesn't seem to want to work? Using the graph API i was able to do the same thing i am trying to do via PHP so i know it works since it returns a json ID and when i refresh the page i see the "testing" comment...: And what makes it more odd is that, i can use the above code to comment on just a comment that doesnt have an image posted... But if i am commenting on a image that was posted then i get that error???!?!?!? I use this code to sussesfully post to a non-image post (as in, just someone posting text). Where xxxxxxxxxxxx is the post ID and yyyyyyyyyyyyyy is the users ID who posted the comment that i am posting my comment to. $comment = $facebook->api('/xxxxxxxxxxx_yyyyyyyyyyyyy/comments', 'post', array( 'message' => 'testing!', ) ); What am i missing??? Edited February 16, 2014 by stealthrt Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.