Sayfayı sitemde yayınlamak istiyorum. . Dokümantasyonda bana yardımcı olabilecek hiçbir şey bulamadım. Ayrıca google sonuçlarından hiçbiri mi cevap vermedi.Sayfanın başı "PHP SDK ile
function post_facebook($data=null){
$result = "";
require_once (ROOT. "/apps/configuration/models/ConfigurationItem.php");
require_once (ROOT . "/components/facebook/facebook.php");
$this->ConfigurationItem = new ConfigurationItem($this->getContext());
$row=$this->ConfigurationItem->findByCatKeyItemKey('system','facebook_login');
$apiid=$row['value'];
$row=$this->ConfigurationItem->findByCatKeyItemKey('system','facebook_pass');
$secret=$row['value'];
$facebook = new Facebook(array(
'appId' => $apiid,
'secret' => $secret,
'cookie' => true,
));
$session = $facebook->getSession();
print_r($session);
$me = null;
if ($session) {
try {
$uid = $facebook->getUser();
$me = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
}
$message=$data['facebook_text'];
$attachment = array(
'message' => $data['facebook_text'],
'name' => $data['name'],
'link' => $this->getLinkToLatestNews(),
'description' => '',
);
if($data['thumb_file_tree_id'] !== NULL) $attachment = $_SERVER['HTTP_HOST']."media/file/image_by_id/".$data['thumb_file_tree_id']."/?w=400&h=500";
try {
$facebook->api('/162618213751448/feed/', 'post', $attachment);
$result = "Facebook: Sent";
} catch (FacebookApiException $e) {
$result = "Facebook: Failed";
error_log($e);
}
} else {
$login_url = $facebook->getLoginUrl();
header("Location: ".$login_url);
exit;
}
return $result;
}
yanlış parçasıdır:
$session = $facebook->getSession();
$me = null;
if ($session) {
(...)
} else {
$login_url = $facebook->getLoginUrl();
header("Location: ".$login_url);
exit;
}
Ben kullanıcı belirtilen FB hesabını (bu sayfayla) giriş yapılmasını ve ardından göndermesine izin istiyorum. Uygulama ayarları yalnızca bu hesabın yayınlanmasına izin veriyor, bu yüzden tamam olmalı ... Ama değil. FB hesabını kapattığımda, oturum hala var, ancak istisna döndürüyor. Sorun nedir?
teşekkür! Mükemmel. – Memochipan