tha*_*smt 4 facebook facebook-page facebook-graph-api facebook-timeline
Facebook 今天发布了新的页面时间轴.安装在页面上作为"标签"的应用程序现在显示在时间轴上方,带有111px x 74像素大小的缩略图"app image".如果您在Facebook页面管理界面中导航,则可以在每页上自定义此项(就像自定义选项卡名称一样).
您可以通过Open Graph API更新选项卡的"自定义名称" ,但它们似乎没有更新其API文档以显示如何上传自定义tab_image(假设它们将).现在有可能但没有证件吗?有没有人想出怎么做呢?
tha*_*smt 10
使用最新的Open Graph 2.5 API tabs端点和PHP SDK 5,代码应如下所示:
<?php
$fb = new Facebook\Facebook([/* . . . */]);
$response = $fb->post(
'/{page-id}/tabs',
[
'custom_name'=>'My Custom Tab',
'custom_image_url'=>'http://publicly.accessible/image.jpg',
'app_id'=>'{app-id}',
],
'{page-access-token}',
);
Run Code Online (Sandbox Code Playgroud)
我想通了,就像上传图片一样.该字段称为"custom_image".据推测,他们很快就会更新文档.很高兴他们使用新版本快速启用此API挂钩!
以下是使用Facebook PHP SDK的方法:
<?php
$page_access_token = 'XXXXXXX'; // you'll need the manage_pages permission to get this
$facebook = new Facebook(array(
'appId' => 'YOUR_APP_ID',
'secret' => 'YOUR_APP_SECRET',
'fileUpload' => true, // enables CURL @ file uploads
));
$facebook->api(
'/PAGE_ID/tabs/TAB_NAME', // looks like "app_xxxx" where xxxx = APP_ID
'POST' // post to update
array(
'custom_image' => '@' . realpath('path/to/my/file.jpg'),
'custom_name' => 'My App', // give it a custom name if you want too
'access_token' => $page_access_token // access token for the page
)
);
Run Code Online (Sandbox Code Playgroud)
干杯
| 归档时间: |
|
| 查看次数: |
3346 次 |
| 最近记录: |