想要在脸书上分享网站内容


Want to share website content on facebook

我在Facebook分享中遇到了问题:我想用php在Facebook上发布内容,标题,URL,但我无法发布除URL之外的所有内容。

我有一个链接可以在Facebook上分享。

   <a onClick="window.open('http://www.facebook.com/sharer.php?s=100&amp;p[title]=
     <?=$forum_list['subject']; ?>&amp;p[summary]=
     <?= $forum_list['content'] ?>&amp;p[url]=
     <?php echo $url; ?>&amp;p[images][0]=
     <?php //$image;?>','sharer','toolbar=0,status=0,width=548,height=325');
       " href="javascript: void(0)">
     <img src="<?php echo BASE_URL; ?>img/face.png" />
   </a>
<!--use this meta tag -->
    <meta property="og:title" content="<?php echo $deal['deal_title'] ;?>" />
    <meta property="og:url" content="<?php echo $_SERVER['REQUEST_URI'];?>" />
    <meta property="og:image" content="http://domain.com/img/<?php echo $deal['deal_image']; ?>" />
    <meta property="og:image:type" content="image/jpeg" />
    <meta property="og:image:width" content="620" />
    <meta property="og:image:height" content="541" />
<!-- Put this ancor tag in your body -->
<a onclick="fb_Share();" title=" Facebook - Share And Earn"><img src="img/fb-earn.gif" alt=" Facebook - Share And Earn" width="299" height="60"></a>
<!-- use this Javascript -->
<script src="http://connect.facebook.net/en_US/all.js"></script>
   <script>
     function fb_Share(){
         FB.init({ 
            appId:'apID', cookie:true, 
            status:true, xfbml:true 
         });
         FB.ui({ method: 'feed',
                link: document.URL,
            },
            function(response) {
        if (response && !response.error_code) 
          {
               // you action    
          } 
       else 
           {
              alert(response);
          }
      }
            );
      }
      </script>

sharer.php只接受URL作为参数,它直接从URL读取Open Graph标签,你不能动态设置任何东西(再)。

有关特定 Open Graph 标记的更多信息:http://ogp.me/