Friday, 13 June 2014

Get Facebook Likes Count of a page using Graph API

This small code snippet given below uses FaceBook’s graph api and returns the likes count of the page. There is no need to have the FaceBook access token to call the api and get the result.
//The following code returns the Number of likes for any facebook page.
//Page Id of Knowledgecotner Replace it with your page.
$page_id = "556271807742934";
$likes = 0; //Initialize the count
//Construct a Facebook URL
$json_url =''.$page_id.'';
$json = file_get_contents($json_url);
$json_output = json_decode($json);
//Extract the likes count from the JSON object
    $likes = $json_output->likes;

//Printing the count
echo $likes.' Facebook Fans';

Tuesday, 10 June 2014

How To Display Twitter Followers Count In PHP

Twitter is one of the most used social networking websites on the internet. Twitter API allows you to retrieve info for specific user. All you need to do is to enter the handler of the user. You can easily retrieve a specific Twitter user’s followers count with a small snippet:

Friday, 6 June 2014

Php : create pdf from html using mpdf

Many php applications need to create pdf of documents like invoice , receipt and even id card etc. In this article we shall create a pdf invoice using the mpdf pdf creation library. Mpdf is made in php without any other external library. Mpdf parses css much better than any other free pdf libraries like tcpdf and creates pdf files which resemble the original html file to a large extent. Along with html to pdf, mpdf can also be used to create 1d barcodes of various formats.