2014-03-06 65 views
1

需要授權這是我嘗試了Facebook的調試工具:URL返回一個錯誤的HTTP響應代碼/ 401在Facebook上分享

https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fdevstmaws.linesofphp.com%2Fvideo%2Findex%2F52f0fd544eab99ae28000106

刮信息:

Response Code 401 
Fetched URL http://devstmaws.linesofphp.com/video/index/52f0fd544eab99ae28000106 
Canonical URL http://devstmaws.linesofphp.com/video/index/52f0fd544eab99ae28000106 
Warning 
Critical Errors That Must Be Fixed 
Bad Response Code URL returned a bad HTTP response code. 
Warning 
Errors That Must Be Fixed 
Missing Required Property The 'og:type' property is required, but not present. 
Notice 
Open Graph Warnings That Should Be Fixed 
Inferred Property The 'og:url' property should be explicitly provided, even if a value can be inferred from other tags. 
Inferred Property The 'og:title' property should be explicitly provided, even if a value can be inferred from other tags. 
URLs 
Graph API https://graph.facebook.com/1419346681640654 
Scraped URL See exactly what our scraper sees for your URL 

的URL,我會喜歡分享的是:http://devstmaws.linesofphp.com/video/index/52f0fd544eab99ae28000106

可能是什麼原因?這不是在刮我的網站了。

Scraper response: Document returned no data 

Meta標籤:

<meta property="og:image" content="http://devstmaws.linesofphp.com/static/img/logo_facebook.jpg" /> 
<meta property="og:image:type" content="image/jpeg" /> 
<meta property="og:image:width" content="300" /> 
<meta property="og:image:height" content="300" /> 
<meta property="og:title" content="Check out my awesome video!" /> 
<meta property="og:site_name" content="Check out my awesome video!" /> 
<meta property="og:description" content="SearchTheMusic gives you the ability to legally add music to your videos and share them with the world!" /> 
<meta property="og:url" content="http://devstmaws.linesofphp.com/video/index/52f0fd544eab99ae28000106" /> 

回答

2

的Facebook必須能夠訪問的URL打開圖標籤的工作,和你的網址是由密碼保護的。只有公共網址是可能的。如果您取消授權彈出窗口,您會得到相同的錯誤。

+0

謝謝!但在我的另一臺登臺服務器上工作之前。網址:http://muserk.sourcepadstage.com w /授權也。我很有信心,它也可以在我的另一臺登臺服務器上工作,但我需要401授權。 – xirukitepe

+0

它確實沒有真正的工作,但在登臺服務器上的密碼保護不會返回錯誤 - 它只是要求輸入密碼。這很煩人,因爲你不能關閉瀏覽器標籤,這很容易... – luschn

-1

使用JavaScript SDK的Facebook 我已經克服了中間步驟。 我的項目網址也受密碼保護。

所以我借這個步驟:

  1. 我已創建的文件夾,項目文件夾外(密碼保護).i.e。並創建一個文件,比如projectfront.php

  2. 使用Facebook sdk調用函數並使用FB.ui({ with method:feed。我已經採取了一些伎倆。在鏈接中,我使用了上述文件路徑。所以現在Facebook不能濫用我。

<div><a href="javascript:void(0);" onclick = "sharesend()">share</a></div> 
<script> 
function sharesend() 
{ 
    FB.ui({ 
    method: 'feed',   
    link: '[your servar path]/outerface/projectfront.php', 
    picture: [give picture, if you can], 
    caption: [give any caption], 
    description: [give any description], 
      ....................., 
      .............. 
    }, 
    function(response){} 
    ); 
} 
</script> 

outerface/projectfront.php - 我已經寫了(適當的doctype)爲:

...... 
........ 
<script> 
function xyz() 
{ 
url=[Give your target link];// it will your project page, which you want to share. 
window.location=url; 
} 
</script> 
</head> 
<body onload="xyz()"> 

<?php 
ob_start(); 
?> 
Please wait.... 
</body> 
</html> 
[please do proper html] 

所以,現在,如果你的分享按鈕的任何用戶點擊分享將會成功,Facebook不會阻礙我們。另外,如果您點擊共享後Facebook上的鏈接(牆上),您將成功重定向到您在projectfront.php中定義的鏈接。

感謝 Atanu米特拉

0

我給你還有其他的方式。在這裏,我刪除JavaScript的SDK。其他都是一樣的 採取中間步驟。
所以我採取這個步驟: 我已創建文件夾,項目文件夾(密碼保護).i.e之外。並創建一個文件,比如projectfront.php 第一張: 定義了一個外部url 在這裏,我已經使用了上述文件路徑。所以現在Facebook不能濫用我。

<?php 
$faceproject_url='[your servar path]/outerface/projectfront.php'; 

?> 
<div class="fb-share-button" data-href="<?php echo $faceproject_url; ?>" data-type="button_count"></div> 

Second: 
In outerface/projectfront.php- 
I have written(with proper doctype) as: 
...... 
........ 
<script> 
function xyz() 
{ 
url=[Give your target link];// it will your project page, which you want to share. 
window.location=url; 
} 
</script> 
</head> 
<body onload="xyz()"> 

<?php 
ob_start(); 
?> 
Please wait.... 
</body> 
</html> 
[please do proper html] 

So now if any user click on your share button, share'll be successfully done and Facebook will not obstacle us. Also If you click on link on Facebook(in wall) after share, you will redirect successfully to your link defined in projectfront.php. 

Thanks 
Atanu Mitra 
+0

你應該刪除你的一個答案。因爲兩者都是相同的 –

0

當抓取的頁面URL和OG:URL不匹配時,通常會收到此錯誤。

相關問題