简体   繁体   English

如何正确发布Open Graph操作?

[英]How to correctly publish Open Graph action?

I am trying to publish my Open Graph action to the wall. 我正在尝试将“开放图谱”操作发布到墙上。 All meta tags are set up, but I don't know, which parameter I should add to this command: 所有元标记均已设置,但我不知道应在此命令中添加哪个参数:

$facebook->api('/me/APP_URL_NAME:action_name','POST', array('image'=>$meta_shoe_image));

returns: 返回:

Fatal error: Uncaught Exception: The action you're trying to publish is invalid because it does not specify any reference objects. At least one of the following properties must be specified: OBJECT_NAME. thrown in _FB_LIBRARY_

when I try 当我尝试

$facebook->api('/me/APP_URL_NAME:action_name','POST', array('OBJECT_NAME'=>'http://apps.facebook.com/APP_URL_NAME:action_name', 'image'=>$meta_shoe_image));

which returns 哪个返回

Fatal error: Uncaught OAuthException: (#3502) Object at URL http://apps.facebook.com/APP_URL_NAME/ has og:type of 'website'. The property 'shoe' requires an object of og:type 'APP_URL_NAME:OBJECT_NAME'. thrown in _PATH_TO_FB_LIBRARY_

What am I doing still wrong? 我在做什么还是错了? Where can I get, what should be 'OBJECT_NAME'=>'_HERE_' ? 在哪里可以找到'OBJECT_NAME'=>'_HERE_'

EDIT: Also, when I try to obtain current URL address and push it into the Facebook function: 编辑:另外,当我尝试获取当前URL地址并将其推入Facebook函数时:

function curPageURL() {
 $pageURL = 'http://';
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}
$facebook->api('/me/APP_URL_NAME:action_name','post', array('OBJECT_NAME' => curPageURL(), 'image' => $meta_shoe_image));

I get 我懂了

Fatal error: Uncaught Exception: Could not retrieve data from URL. thrown in _FB_FILE_

Fatal error: Uncaught OAuthException: (#3502) Object at URL http://apps.facebook.com/APP_URL_NAME/ has og:type of 'website'. 致命错误:未捕获的OAuthException:(#3502)URL http://apps.facebook.com/APP_URL_NAME/上的对象的og:type为“网站”。 The property 'shoe' requires an object of og:type 'APP_URL_NAME:OBJECT_NAME'. 属性“ shoe”需要使用og:type“ APP_URL_NAME:OBJECT_NAME”对象。 thrown in _PATH_TO_FB_LIBRARY_ 抛出_PATH_TO_FB_LIBRARY_

That sounds like you are trying to use your app's canvas page URL on Facebook as the Open Graph object you are trying to publish an action upon. 听起来您好像正在尝试在Facebook上将应用程序的画布页面URL用作要在其上发布操作的Open Graph对象。

You can't do that – it has to be a “stand-alone” web page, and it has to have it's og:type set up in the meta tags as 'APP_URL_NAME:OBJECT_NAME'. 您无法做到–它必须是“独立”网页,并且必须在meta标记中将og:type设置为“ APP_URL_NAME:OBJECT_NAME”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM