私のindex.php
タグヘッドにi入力コード
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# website: http://ogp.me/ns/website#"> <meta property="fb:app_id" content="418895381495750" />
<meta property="og:site_name" content="Social News" /> <meta property="og:title" content="Sample Title" />
<meta property="og:description" content="Sample Artice" />
<meta property="og:type" content="website" />
<meta property="og:image" content="http:www.myurl.com/wallpaper.png" /> <meta property="og:url" content="<?php echo 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; ?>"/> </head>
およびタグ本体の入力
<div id="wrapper"
<div id="bottom">
<?php
$p=$_GET["p"];
switch($p)
{
case "news": require "blocks/news.php"; break;
case "title": require "blocks/tile.php"; break;
default: require "blocks/home.php";
}
?>
</div>
</div>
私のnews.php入力コードで
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '41834663463370', // App ID
oauth : true,
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.login(function(response) {
if (response.authResponse) {
console.log('Access Token: ' + response.authResponse.accessToken);
} else {
console.log('User cancelled login or did not fully authorize.');
}
},{scope:'publish_stream'});
};
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>
<script type="text/javascript">
function readnews()
{
FB.api( '/me/news.reads?article=<?php echo 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];?>','post',
function(response) {
var msg = 'Error occured';
if (!response || response.error) {
if (response.error) {
msg += "\n\nType: "+response.error.type+"\n\nMessage: "+response.error.message;
}
alert(msg);
} else {
alert("Post timeline");
}
});
}
</script>
しかし、なぜタイムラインにurlファイルindex.phpの
例を表示するのかわかりません:Adamはサンプルタイルを読みました。-> http://myurl.com/index.php
は私の投稿のURLを表示しませんhttp://myurl.com/index.php?p=news&id={$_getid }