Press enter to see results or esc to cancel.


Dynamic Facebook share button in PHP

In this video I have shown how to create dynamic facebook share button. Usually we copy paste the URL in the share code generator and get the code for each page manually.
visit the below page for manually generating the code sharer.
Create Facebook Share button for Website Webpages

Now just copy the below code to all your webpages. It will create share button automatically for all your webpages.
No need to create it manually for all pages.

<?php
$actual_link = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
echo $actual_link;
?>

<br>

<?php
echo '<iframe src="https://www.facebook.com/plugins/share_button.php?href='.$actual_link.'&layout=button_count&size=large&mobile_iframe=true&width=83&height=28&appId" width="83" height="28" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true"></iframe>';
?>

Here is an example for dynamic Share button in PHP.
https://chillyfacts.com/Share-test-facebook.php


Comments

Leave a Comment