Skip to content

Instantly share code, notes, and snippets.

@mloza
Last active October 2, 2019 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mloza/8e3b4718d3d0b2d73c733e4b264af4fc to your computer and use it in GitHub Desktop.
Save mloza/8e3b4718d3d0b2d73c733e4b264af4fc to your computer and use it in GitHub Desktop.
<?php
$source_url = 'http://blog.mloza.pl';
$url = "http://api.facebook.com/restserver.php?method=links.getStats&urls=".urlencode($source_url);
$xml = file_get_contents($url); $xml = simplexml_load_string($xml);
$shares = $xml->link_stat->share_count; // Liczba share
$likes = $xml->link_stat->like_count; // Liczba like
$comments = $xml->link_stat->comment_count; // Liczba komentarzy
$total = $xml->link_stat->total_count; // Sumarycznie
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment