Skip to content

Instantly share code, notes, and snippets.

@SecureCloud-biz
Created July 12, 2014 23:43
Show Gist options
  • Save SecureCloud-biz/e8df3d8f1761cb6bf242 to your computer and use it in GitHub Desktop.
Save SecureCloud-biz/e8df3d8f1761cb6bf242 to your computer and use it in GitHub Desktop.
Adding a comment with a photo to Facebook
<?php
include "facebook/facebook.php";
$facebook = new Facebook( array( 'appId' => APP_ID, 'secret' => APP_SECRET ) );
// enable upload support
$facebook->setFileUploadSupport( true );
// set access token for user / page here (not needed if you intend to use the login flow beforehand)
$facebook->setAccessToken( ACCESS_TOKEN );
// object you want to comment on (can be status update, photo, link etc)
$object_id = '60506094_10100351413616696';
$comment_with_url = $facebook->api( $object_id . "/comments", "POST", array(
'attachment_url' => 'http://healthhub.co/wp-content/uploads/2014/02/Group-Slider.jpg',
'message' => "Join the team!"
) );
// will return id of comment on success
print_r( $comment_with_url );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment