2012-03-04 2 views
1
<?php 
require "src/facebook.php"; 

$facebook = new Facebook(array(
'appId'=>'xxxxxxxxx', 
'secret'=>'xxxxxxxxxxxxxxxxx', 
'cookie'=>true 
)); 

if(!$facebook->getUser()) 
{ 
$url = $facebook->getLoginUrl(array('scope'=>'email,publish_actions')); 
echo "<script> top.location=\"".$url."\"; </script>"; 
exit(0); 
} 

$params = array('article'=>'http://www.xxxxxxxxx.com/script/','access_token'=>$facebook->getAccessToken()); 

$out = $facebook->api('/me/namespace:read','post',$params); 

print_r($out); 

exit(0); 

?> 

하지만 몇 가지 질문이 있는데,이 메타 태그는 어디에 넣어야합니까? 난 단지 자바 스크립트 예제를 발견하고 어떻게 같은 동적 URL을 사용하는 또 다른 질문이 있어요 :페이스 북으로 타임 라인에서 작업 게시 php sdk

Fatal error: Uncaught OAuthException: (#3502) Object at URL http://www.xxxxxxxxx.com/script/?article_id=xxxx has og:type of 'website'. The property 'article' requires an object of og:type 'namespace:article'. thrown in xxxxxxx on line 1106 

감사 :이 URL의 일부 매개 변수를 넣어하려고하면

http://www.xxxxxxxxx.com/script/?article_id=xxxx

이 같은 오류를 반환 . http://www.xxxxxxxxx.com/script/?article_id=xxxx< 머리 > 섹션에

답변

1

이 같은 것을 추가해야합니다 :

<head> 
    <title>My article</title> 
    <meta property="og:title" content="My article" /> 
    <meta property="og:type" content="namespace:article" /> 
    <meta property="og:url" content="http://www.xxxxxxxxx.com/script/?article_id=xxxx" /> 
    <meta property="og:image" content="http://www.xxxxxxxxx.com/image.jpg" /> 
    <meta property="fb:app_id" content="xxxxxxxx" /> 
    <meta property="og:description" content="My wonderful article" /> 
</head> 

를 네임 스페이스에서 나는 당신이 당신의 자신의 기사 객체를 정의하고 didn를 같은데요 오류 메시지에 builtin article object을 사용하십시오.

+0

JavaScript SDK를 통해이 작업을 수행하려고 시도하지 않고 있습니다. PHP SDK는이 정보를 전혀 보지 못합니다. – OpensaurusRex

+0

나는 동의하지 않는다. 오류 메시지는 Facebook의 스크레이퍼에서 발생합니다. 스크레이퍼는 어떤 SDK를 선택하든 상관하지 않습니다. –

+0

당신 말이 맞아요. 나는 서류들을 다시 읽고 실제로 요구되는 것을 보았습니다. – OpensaurusRex

관련 문제