Last active
December 22, 2015 19:39
-
-
Save gimesi/6521397 to your computer and use it in GitHub Desktop.
Show the number of likes of a Facebook page with this php snippet using the cURL function.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Show the number of likes of a Facebook page | |
<?php | |
$url = "http://graph.facebook.com/YOURPAGENAME"; // enter your fb-sitename here | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
$results = curl_exec($ch); | |
curl_close($ch); | |
$json = json_decode($results, true); | |
?> | |
<?php echo $json['likes']; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment