facebooklaravel-5facebook-likebox

How to get number of likes only of a Facebook page?


I'm using this code:

<div class="fb-like" data-href="https://web.facebook.com/mykliktransport/" data-layout="box_count" data-action="like" data-size="large" data-show-faces="false" data-share="false"></div>

it is showing like this:

but what is want is only the count to show it here : enter image description here


Solution

  • Its working now... This may help Get your token number from https://developers.facebook.com/docs/graph-api

    <?
     $fb_page = '1907481709532899'; 
     $access_token = 'Token Number';
     $url = "https://graph.facebook.com/v2.2/".$fb_page.'?access_token='.$access_token;
     $curl = curl_init($url);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);   
     curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
     $result = curl_exec($curl);  
     curl_close($curl);
     $details = json_decode($result,true);
     echo $details['likes'];
    ?>