Facebook like Server error 500

落花浮王杯 提交于 2020-01-06 20:04:00

问题


I wanted to add a Facebook like button to one of the pages of my website. However, I'm being bothered by this Server error 500. You see, when I click the Facebook like plugin, it opens up the facebook login box. I enter my login credentials and then the login box disappears and it momentarily displays up my FB profile image beneath the like button on the page. The image then vanishes and it displays a "Confirm" box which when clicked displays this Server 500 error.

Below is the code which I tried (and all of them fail)

1) Placed below just after <body>

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

Placed at the position wherein I wanted the Flike button to get displayed.

 <div class="fb-like" data-send="true" data-width="450" data-show-faces="true"></div>

2) <iframe src="https://www.facebook.com/plugins/like.php?href=MY_URL_HERE" scrolling="no" frameborder="0" style="border:none; width:450px; height:80px"></iframe>

I googled a lot for this but still no avail till I found this - http://mashable.com/2010/06/01/facebook-like-button-broken/

Can anyone please let me know what's wrong here? If this is a duplicate question, please link this up with the correct one here. Thanks.


回答1:


Apologies, since this is a very late response. Since you've tagged your question with yii, let me try to give you a YII-alternative.

http://www.yiiframework.com/extension/faceplugs/ - This is a wrapper for Facebook plugins using the Open graph protocol and JavaScript SDK.

From the above page, insert the FB like button as -

$this->widget('ext.faceplugs.LikeButton', array(
   'url' => $this->createAbsoluteUrl('/'),
   'og' => $og,
   'layout' => 'button_count',
   'action' => 'recommend',
   'colorscheme' => 'dark',
));

where , Open graph properties are passed to the plugin using $og array.

Try this and let me know if it works for you.



来源:https://stackoverflow.com/questions/11932700/facebook-like-server-error-500

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!