Search code examples
phpimagefacebookfeed

fb feed does not show picture or info


the result

Hi everybody, I have a problem with sharing a post on the Facebook, using the feed method. I saw the other questions here but are very old and in the mean time FB changed a lot of things, deprecating etc. So, my problem is that the pop-up window does not take the right picture and info from the link. Here it is what I've done for now: - in the head of the shared page (index.php)

<meta property="og:url"           content="http://www.example.com/test/index.php" />
<meta property="og:type"          content="website" />
<meta property="og:title"         content="My title" />
<meta property="og:description"   content="Some description" />
<meta property="og:image"         content="http://www.example.com/test/images/fb_952_498.jpg" />

in the other page:

<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : '123456789',
      xfbml      : false,
      version    : 'v2.10'
    });
  };

  (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/ro_RO/sdk.js";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));
</script>

<script type="text/javascript">
function Post_Imagine(){
    FB.ui({
      method: 'feed',
      link: 'http://www.example.com/test/index.php',
      caption: 'Some text',
    }, function(response){});
}


Solution

  • I went to the debugger and it turns out that Facebook didn't made the refresh of their cache. I insisted 4-5 times and in the end it worked. So, those interested, the code works. :)