Answer the question
In order to leave comments, you need to log in
Facebook. Like groups/urls via API (PHP)?
Hello!
There was a need to like a group in FB, through the API.
At the moment I'm just sharing links:
<?
require 'lib/facebook.php';
$facebook = new Facebook(
array(
'appId' => "0",
'secret' => "0",
'cookie' => false
)
);
$login_url = null;
$user = $facebook->getUser();
$text = "Hello Kitty!";
if (!empty($user)) {
try { $user_profile = $facebook->api('/me'); }
catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
} else $login_url = $facebook->getLoginUrl($params = array('scope' => 'manage_pages,offline_access,publish_stream,read_stream'));
if ( $user ){
try { $message = $facebook->api("/{$user}/feed", "post", array("message"=>$text)); }
catch (FacebookApiException $e) {
error_log($e);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question