How to share a page in facebook
Today people use social networking site not only to make friend but also to share their contents.
Facebook offer a share dialog to share a link or page URL. people can share links on their timeline, in groups, or to their friends.
You can use following code to share link or page URL
<a href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Ffbchandra.com" target="_blank"> Share on Facebook </a>
Use your desired link or page URL in place of 'http%3A%2F%2Ffbchandra.com'. URL should be encoded.
It shares the content which is taken from og:image, og:title and og:description of the page.
People can like, comment and share on the content which is shared using this code.
For details please refer https://developers.facebook.com/docs/plugins/share/
You can customize title, image and description also.
Use following code to customize all content
Images should follow aspect ratio ie. its size should be in ratio of 4:3 or 3:2, like this
Following example shows how to use it.
$title=urlencode("Share your link on facebook");
$summary="Share your link on facebook using sharer.php. You can choose your custom title, image and summary to share content on facebook timeline.";
<a title="Share it on Facebook" href="http://www.facebook.com/sharer.php?s=100&p[url]=<?php echo $url ?>&p[images]=<?php echo $img ?>&p[title]=<?php echo $title ?>&p[summary]=<?php echo $summary ?>" target="_blank"> <img src="http://www.fbchandra.com/images/fbshare.jpg" alt="Share on Facebook" /> </a>