facebook分享没有抓取og:image

时间:2018-03-05 15:08:08

标签: image facebook share meta-tags

我添加了FB分享对话框以在Facebook上分享图像。我已经尝试了所有可能的解决方案,但它仍然没有提取图像。在某些帖子之后,它有效但不是大多数时间。

我使用php curl

强行抓取了网址
$current_url = get_permalink();
    $curl = 'https://graph.facebook.com/';
    $return = getCurlRequest($curl,'id='http://viralsyndicator.com/best-spring-fishing-lures-of-2018-bass-pro-shops-challenge/'&scrape=true&access_token=token');

    function getCurlRequest($url,$postdata=""){ 
      //echo $url;
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:','Content-Type: application/json'));  
      curl_setopt($ch, CURLOPT_POST, 1);
      curl_setopt($ch, CURLOPT_POSTFIELDS,$postdata);
      curl_setopt($ch, CURLOPT_TIMEOUT_MS, 10000);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      $response  = curl_exec($ch);
      //echo '<pre>';print_r($response);
      curl_close($ch);  
      if ($response == false){ return false;}
      return $response;
    }

此页面始终包含og:image元标记,但仍无效。当我使用fb调试工具并进行调试时,第一次它会显示og:image应该提供,在2-3次开始工作后将其抓取。

我尝试过og:image:width属性。

我正在使用wordpress插件进行分享,我也手动使用FB.ui并且它可以用于共享,但我也使用FB评论插件,当我评论和检查复选框以便在fb上发布时,它不是发布图片,我不知道如何手动使用FB评论插件同样共享以获取正确的图像而不是徽标。

FB.ui({
                        method: 'share',
                        href: '<?php echo $postUrl; ?>',
                        picture: "http://viralsyndicator.com/wp-content/uploads/2018/02/0-199-670x377_c.jpg",
                        title: 'title',
                        description: '<?php echo $decodedPostTitle; ?>',

                    }, function(response) {});

我不知道如何解决这个FB问题。请帮助。

由于

0 个答案:

没有答案
相关问题