1. Register your Developer Account at Facebook Developer: https://developers.facebook.com/.
  2. From menu top right „My Apps” select „Add New App„.
    001
  3. Create new application Create New App ID:
    – Enter application name in field „Display Name„.
    – Enter contact E-Mail address „Contact Email„.
    – Choice your category „Category” – „Apps for Pages„.
    – Once click on „Create AppID„, enter captcha code and wait a while…
    002
  4. Your application has been crated. On menu top left click on „Dashboard” – you see details (API Version, App ID, App Secret (when you click on „Showbutton)).
    003
  5. Now you mast go to Graph API Explorer, URL address: https://developers.facebook.com/tools/explorer/224766641284826.
  6. From second top left menu on right side „MyApp” choice your application before called „MyApp„.
    004
  7. From third party from top menu on right side, click on „Get App  Token„.
    005
  8. Copy your Access Token.
    006
  9. Let’s play with PHP Code :)
  10. Now write TOTAL PAGE LIKES fan_count:
    <?php
    function FBLikeCount($FacebookPageId,$FacebookAppToken){
    $JsonUrl ='https://graph.facebook.com/'.$FacebookPageId.'?access_token='.$FacebookAppToken.'&fields=fan_count';
    $Json = file_get_contents($JsonUrl);
    $JsonOutput = json_decode($Json);
    if($JsonOutput->fan_count){
    return $FBFanCount = $JsonOutput->fan_count;
    }else{
    return 0;
    }}
    ?>
    
    <?php
    $FacebookPageId = '_your_page_id_or_page_name_on_facebook_';
    $FacebookAppToken = '_your_access_token_';
    ?>
    
    <?php
    echo FBLikeCount($FacebookPageId,$FacebookAppToken);
    ?>

Facebook Comments

Zostaw komentarz

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *

ZOBACZ RÓWNIEŻ

POBIERANIE ID3 GET ID3 TAG

Pobieranie TAG’ów ID3 z pliku MP3. Get ID3