share content

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

<a title="Share it on Facebook" href="http://www.facebook.com/sharer.php?s=100&p[url]=url&p[images][0]=img&p[title]=title&p[summary]=the description" target="_blank"> <img src="your/path/to/facebook-icon.png" alt="Share on Facebook" /> </a>

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.

<?php

$url=urlencode("http://www.fbchandra.com/developers/share-page-on-facebook");

$img=urlencode("http://www.fbchandra.com/media/developers/share-page.jpg");

$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][0]=<?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>

htyhtyy
By rthrhr at 2016-08-02 23:10:30
Name
Email
Comments
Back
Funding

We need your support to operate it properly. We have lots of ideas but less fund, so help us with your funding.

Thoughts for the day

If A is a success in life, then A equals x plus y plus z. Work is x; y is play; and z is keeping your mouth shut.

Albert Einstein
Polls
Which device you use most for facebook application?
Laptop/PC
20%

 


Android
53%

 


IOS
13%

 


Blackberry
14%

 


Tutorial On Request
Q. Ask us for any tutorial or any thing which helps to build your career better.
Email:
Query: