I think everybody sees a share button on websites and wonder that it is complex to implement. But in reality, it is so easy and you don't need to use any official API or libraries for that. All you have to do is embed the URL of your web page into the following HTML snippet. If you are using facebook SDK for authentication then you can explicitly ask for permission for posting in user feed when they logged in. But it is a little more complex method as we need to use facebook SDK and create an app and get permissions from facebook after verifying app etc. So I am skipping that method for another time.
Here is the code for making facebook share button in your website
<a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo "http://shareurcodes.com"; ?>" target="_blank"> Share on Facebook </a>
Here is the code for making google plus share button in your website