Php 在用户墙上张贴图片,并附上应用程序消息和应用程序URL
在我的应用程序中,我在墙上张贴图像,效果很好,但现在我的要求是打印带有消息的应用程序URL,这样当用户单击链接时,他就会被重定向到我的应用程序。你可以使用curl方法,我使用这个方法,效果很好Php 在用户墙上张贴图片,并附上应用程序消息和应用程序URL,php,facebook-graph-api,facebook-php-sdk,Php,Facebook Graph Api,Facebook Php Sdk,在我的应用程序中,我在墙上张贴图像,效果很好,但现在我的要求是打印带有消息的应用程序URL,这样当用户单击链接时,他就会被重定向到我的应用程序。你可以使用curl方法,我使用这个方法,效果很好 $attachment = array( 'access_token' => "accesstoken", 'caption' => "Hey -- this is caption
$attachment = array(
'access_token' => "accesstoken",
'caption' => "Hey -- this is caption",
'description' => "Your Desc",
'link' => "http://www.example.com/",
'picture'=> "path/image.png"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://graph.facebook.com/XXXXXX/feed');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //to suppress the curl output
$result = curl_exec($ch);
curl_close ($ch);
伟大的您需要我们提供什么?您可以将消息应用到图像,只需将消息添加到您使用facebook api的阵列中即可。