Hire a web Developer and Designer to upgrade and boost your online presence with cutting edge Technologies

Friday, October 14, 2022

Dynamic Facebook share button in PHP

 

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>';
?>

No comments:

Post a Comment