Skip to content

Instantly share code, notes, and snippets.

@pietromalerba
Forked from niraj-shah/photo_comment.php
Last active August 29, 2015 14:12
Show Gist options
  • Select an option

  • Save pietromalerba/512748c317cc2d555291 to your computer and use it in GitHub Desktop.

Select an option

Save pietromalerba/512748c317cc2d555291 to your computer and use it in GitHub Desktop.
<?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