php facebook api在facebook墙上发布发布动作
我们开发了一个购物网站,我们使用facebook登录,当客户购买时,我们已经在他们的墙上张贴了产品。为了执行此操作,我在developer.facebook.com中创建了一个应用程序,使用xxx@test.com. 如果我使用xxx@test.com然后登录我的网站,购买一个发布到facebook墙上的产品,但如果我使用不同的帐户,就会得到例外php facebook api在facebook墙上发布发布动作,php,facebook,facebook-graph-api,facebook-php-sdk,Php,Facebook,Facebook Graph Api,Facebook Php Sdk,我们开发了一个购物网站,我们使用facebook登录,当客户购买时,我们已经在他们的墙上张贴了产品。为了执行此操作,我在developer.facebook.com中创建了一个应用程序,使用xxx@test.com. 如果我使用xxx@test.com然后登录我的网站,购买一个发布到facebook墙上的产品,但如果我使用不同的帐户,就会得到例外 user not authorized application 我开始用谷歌搜索,最后我提交了“发布行动”许可供审查 这是否是在fb墙上张贴的唯
user not authorized application
我开始用谷歌搜索,最后我提交了“发布行动”许可供审查
这是否是在fb墙上张贴的唯一方法?为什么要用xxx@test.com一个人
这是我使用的代码
public function postFbWall($customer_name) {
if(!isset($this->fbconnect)) {
require_once(DIR_SYSTEM . 'vendor/facebook-sdk/facebook.php');
$this->fbconnect = new Facebook(array(
'appId' => $this->config->get('fbconnect_apikey'),
'secret' => $this->config->get('fbconnect_apisecret'),
"cookie"=>true,
));
$_SERVER_CLEANED = $_SERVER;
$_SERVER = $this->clean_decode($_SERVER);
}
$fbuser = $this->fbconnect->getUser();
if($fbuser){
try {
$fbuser_profile = $this->fbconnect->api("/$fbuser");
$access_token = $this->fbconnect->getAccessToken();
$message = "First three users who registers through this links will get 5% of the product price as reward points";
$attributes = array(
'name' => $customer_name,
'caption' => HTTP_SERVER,
'access_token' => $access_token,
'message' => 'message goes here',
'link' => 'link',
'description' => 'description goes here',
);
$ch = curl_init();
$purl = "https://graph.facebook.com/".$fbuser."/feed";
$mattr = "";
foreach($attributes as $key=>$value):
$mattr .= $key."=".$value."&";
endforeach;
curl_setopt($ch,CURLOPT_URL,$purl);
curl_setopt($ch,CURLOPT_POST,count($attributes));
curl_setopt($ch,CURLOPT_POSTFIELDS,$mattr);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch,CURLOPT_VERBOSE ,true);
$res = curl_exec($ch);
curl_close($ch);
$resultobj = json_decode($res);
if(isset($resultobj->id)) { $res =true;} else {$res=false;}
} catch (FacebookApiException $e) {
error_log($e);
$fbuser = null;
}
}
}
Facebook平台政策现在允许预填充消息。所以你永远不会被批准,只要你这么做that@WizKid很抱歉,你想说的我无法理解…请阅读并特别阅读2.3:“确保用户消息参数中的所有内容都由用户输入。不要预填充。这包括帖子、消息、评论和标题。”。还有一个视频解释什么是预填充。但简短的版本是,用户必须自己手动输入消息。上面的消息是静态的,例如,消息将动态创建,正如我在facebook墙中提到的发布产品。这也不可能?动态创建也是违反策略的。用户必须自己输入消息。