PHP social sharing URLs

  • 14 July, 2018
  • Renish Khunt
  • PHP
  • 126

How we can share Blog / Article / Product on social media using PHP URL. We can get most of the traffic from social media. Every site must have the social media sharing functionality. Social media is the most powerful platform for prompt out Blog / Article / Product.

Let’s see how we can share content on social media from the site using PHP URLs.

First of all, you need to add the meta tags for social media sharing like below.

// Page description must be less then 155 characters.
<meta name="description" content="Page description" />

<meta itemprop="name" content="Blog titel">
<meta itemprop="description" content="Blog description">
<meta itemprop="image" content="imageurl/image.jpg">

<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@publisher_handle">
<meta name="twitter:title" content="Page Title">
// Page description must be less then 200 characters.
<meta name="twitter:description" content="Page description">
<meta name="twitter:creator" content="@author_handle">
<meta name="twitter:image" content="imagepath/image.jpg">

<meta property="og:title" content="Title Here" />
<meta property="og:type" content="article" />
<meta property="og:url" content="site url" />
<meta property="og:image" content="imagepath/image.jpg" />
<meta property="og:description" content="Description Here" /> 
<meta property="og:site_name" content="Site Name" />

Write meta tags on your HTML for social sharing content. for more detail above meta tags read this article.

Now, we will create a URL for social sharing like.

Facebook

Sharer:

https://www.facebook.com/sharer.php?u={url}

Share Dialog:

https://www.facebook.com/dialog/share?app_id={app_id}&display=page&href={url}&redirect_uri={redirect_url}

Twitter

https://twitter.com/intent/tweet?url={url}&text={title}&via={via}&hashtags={hashtags}

Google+

https://plus.google.com/share?url={url}

Pinterest

https://pinterest.com/pin/create/bookmarklet/?media={img}&url={url}&is_video={is_video}&description={title}

LinkedIn

https://www.linkedin.com/shareArticle?url={url}&title={title}

Buffer

https://buffer.com/add?text={title}&url={url}

Digg

http://digg.com/submit?url={url}&title={title}

Tumblr

https://www.tumblr.com/widgets/share/tool?canonicalUrl={url}&title={title}&caption={desc}

Reddit

https://reddit.com/submit?url={url}&title={title}

StumbleUpon

http://www.stumbleupon.com/submit?url={url}&title={title}

Delicious

https://delicious.com/save?v=5&provider={provider}&noui&jump=close&url={url}&title={title}

Blogger

https://www.blogger.com/blog-this.g?u={url}&n={title}&t={desc}

LiveJournal

http://www.livejournal.com/update.bml?subject={title}&event={url}

MySpace

https://myspace.com/post?u={url}&t={title}&c=desc

Yahoo

http://compose.mail.yahoo.com/?body={url}

FriendFeed

http://friendfeed.com/?url={url}

NewsVine

http://www.newsvine.com/_tools/seed&save?u={url}

EverNote

http://www.evernote.com/clip.action?url={url}

GetPocket

https://getpocket.com/save?url={url}

FlipBoard

https://share.flipboard.com/bookmarklet/popout?v=2&title={title}&url={url}

InstaPaper

http://www.instapaper.com/edit?url={url}&title={title}&description={desc}

Line.me

https://lineit.line.me/share/ui?url={url}

Skype

https://web.skype.com/share?url={url}

Viber

viber://forward?text={url}

WhatsApp

whatsapp://send?text={url}

Telegram.me

https://telegram.me/share/url?url={url}&text={title}

VK

http://vk.com/share.php?url={url}

OKru

https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl={url}&title={title}

Douban

http://www.douban.com/recommend/?url={url}&title={title}

Baidu

http://cang.baidu.com/do/add?it={title}&iu={url}

QZone

http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url={url}

Xing

https://www.xing.com/app/user?op=share&url={url}

RenRen

http://widget.renren.com/dialog/share?resourceUrl={url}&srcUrl={url}&title={title}

Weibo

http://service.weibo.com/share/share.php?url={url}&appkey=&title={text}&pic=&ralateUid=

You can set above URL on your site for social sharing you can get more detail about social sharing URL from here.