Last active
June 3, 2017 06:17
-
-
Save niraj-shah/9780965 to your computer and use it in GitHub Desktop.
Adding a comment with a photo to Facebook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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