如何 post Facebook 上的 .swf PHP SDK
How to post a .swf on Facebook PHP SDK
我正在尝试使用 PHP SDK 5.2 post .swf
。我尝试了一些方法。
例如:
$linkData = [
'type'=> "video",
'source'=> "https://mysite/my_file.swf",
'name'=> $_GET['message1'],
'caption'=> $_GET['caption'],
'description'=> $_GET['message2'],
'message' => $_GET['message3']
];
try {
$response = $fb->post('/me/feed', $linkData, $user->access_token);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
$this->ueoutputs['errors'][] = $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
$this->ueoutputs['errors'][] = $e->getMessage();
exit;
}
它给了我 Facebook\Exceptions\FacebookResponseException
:
Template data must be a JSON-encoded dictionary, of the form {'key-1': 'value-1', 'key-2': 'value-2', ...}
如何解决?
尝试将 /me/feed
更改为 /me/videos
。它对我有用。
$response = $fb->post('/me/videos', $linkData, $user->access_token);
解决此问题的方法是使用 Open Graph Protocol。
这是一个例子:
<meta property="og:audio" content="http://example.com/bond/theme.mp3" />
<meta property="og:description"
content="Sean Connery found fame and fortune as the
suave, sophisticated British agent, James Bond." />
<meta property="og:determiner" content="the" />
<meta property="og:locale" content="en_GB" />
<meta property="og:locale:alternate" content="fr_FR" />
<meta property="og:locale:alternate" content="es_ES" />
<meta property="og:site_name" content="IMDb" />
<meta property="og:video" content="http://example.com/bond/trailer.swf" />
我正在尝试使用 PHP SDK 5.2 post .swf
。我尝试了一些方法。
例如:
$linkData = [
'type'=> "video",
'source'=> "https://mysite/my_file.swf",
'name'=> $_GET['message1'],
'caption'=> $_GET['caption'],
'description'=> $_GET['message2'],
'message' => $_GET['message3']
];
try {
$response = $fb->post('/me/feed', $linkData, $user->access_token);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
$this->ueoutputs['errors'][] = $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
$this->ueoutputs['errors'][] = $e->getMessage();
exit;
}
它给了我 Facebook\Exceptions\FacebookResponseException
:
Template data must be a JSON-encoded dictionary, of the form {'key-1': 'value-1', 'key-2': 'value-2', ...}
如何解决?
尝试将 /me/feed
更改为 /me/videos
。它对我有用。
$response = $fb->post('/me/videos', $linkData, $user->access_token);
解决此问题的方法是使用 Open Graph Protocol。 这是一个例子:
<meta property="og:audio" content="http://example.com/bond/theme.mp3" />
<meta property="og:description"
content="Sean Connery found fame and fortune as the
suave, sophisticated British agent, James Bond." />
<meta property="og:determiner" content="the" />
<meta property="og:locale" content="en_GB" />
<meta property="og:locale:alternate" content="fr_FR" />
<meta property="og:locale:alternate" content="es_ES" />
<meta property="og:site_name" content="IMDb" />
<meta property="og:video" content="http://example.com/bond/trailer.swf" />