How to Add Linkedin Share Button in PHP Website?

By Hardik Savani May 14, 2024 Category : PHP

Hello Developer,

Today, the php linkedin share post button is our main topic. if you want to see an example of linkedin share button php then you are in the right place. you can see the custom linkedin share button php. you will learn to create a custom LinkedIn share button php.

In this post, I will show you how to make a LinkedIn share button in php code. we will create a simple "index.php" file and add a LinkedIn share button. When the user clicks on that button then it opens a LinkedIn page and shares your given URL. so, let's see the simple example with output:

index.php

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<title>How to Add linkedin Share Button in PHP - ItSolutionStuff.Com</title>

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">

</head>

<body>

<div class="container">

<h2>How to Add Linkedin Share Button in PHP - ItSolutionStuff.Com</h2>

<?php

$url = "https://www.itsolutionstuff.com/post/whats-new-in-laravel-11-new-features-and-latest-updatesexample.html";

?>

<a href="javascript:window.open('https://www.linkedin.com/sharing/share-offsite/?url=<?php echo $url ?>', '_blank', 'width=400,height=500');void(0);" class="btn btn-primary">Share on Linkedin</i></a>

</div>

</body>

</html>

Output:

I hope it can help you...

Tags :
Shares