{"id":1285,"date":"2013-01-17T11:25:44","date_gmt":"2013-01-17T11:25:44","guid":{"rendered":"http:\/\/webkul.com\/blog\/?p=1285"},"modified":"2013-01-17T15:05:08","modified_gmt":"2013-01-17T15:05:08","slug":"popular-social-media-share-count-on-your-website","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/","title":{"rendered":"Popular Social Media Share Count on your website"},"content":{"rendered":"<p>Simplest way to put the share count of your website url. There having various social media website where you want share your website page.<\/p>\n<p>Here is the the Demo code of getting share count of your share page.<\/p>\n<pre class=\"brush:php\">$uri = &amp; JFactory::getURI();\r\n$pageURL = $uri-&gt;toString();\r\n$encodedPageUrl=urlencode($pageURL);\r\n\r\n# URL for Stumbleupon \r\n$stumbleuponURL = str_replace('http:\/\/','',$pageURL);\r\n$shortPageUrlStumble=urlencode($stumbleuponURL);\r\n$stmbleURL = urlencode($shortPageUrlStumble);\r\n\r\n#Get Number of Tweets from Twitter\r\nfunction get_tweets($url) {    \r\n  $json_string = file_get_contents('http:\/\/urls.api.twitter.com\/1\/urls\/count.json?url=' . $url);\r\n  $json = json_decode($json_string, true);\r\n  return intval( $json['count'] );\r\n}\r\n$count_tweet =  get_tweets($encodedPageUrl);\r\n\r\n#Get Number of Facebook Shares\r\nfunction get_likes($url) {\r\n  $json_string = file_get_contents('http:\/\/api.facebook.com\/restserver.php?method=links.getStats&amp;format=json&amp;urls=' . $url);\r\n  $json = json_decode($json_string, true);  \r\n  return intval( $json['0']['share_count'] );\r\n}\r\n$count_facebook =  get_likes($encodedPageUrl);\r\n\r\n#Get Number of LinkedIn Shares\r\nfunction get_shares($url) {    \r\n  $json_string = file_get_contents(\"http:\/\/www.linkedin.com\/countserv\/count\/share?url=$url&amp;format=json\");\r\n  $json = json_decode($json_string, true);\r\n  return intval( $json['count'] );\r\n}\r\n$count_LinkedIn =  get_shares($encodedPageUrl);\r\n\r\n#Get Number of Google+1\u2032s\r\nfunction get_plusones($url) {\r\n  $curl = curl_init();\r\n  curl_setopt($curl, CURLOPT_URL, \"https:\/\/clients6.google.com\/rpc\");\r\n  curl_setopt($curl, CURLOPT_POST, 1);\r\n  curl_setopt($curl, CURLOPT_POSTFIELDS, '[{\"method\":\"pos.plusones.get\",\"id\":\"p\",\"params\":{\"nolog\":true,\"id\":\"' . $url . '\",\"source\":\"widget\",\"userId\":\"@viewer\",\"groupId\":\"@self\"},\"jsonrpc\":\"2.0\",\"key\":\"p\",\"apiVersion\":\"v1\"}]');\r\n  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);\r\n  curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type: application\/json'));\r\n  $curl_results = curl_exec ($curl);\r\n  curl_close ($curl);\r\n  $json = json_decode($curl_results, true);\r\n  return intval( $json[0]['result']['metadata']['globalCounts']['count'] );\r\n}\r\n$count_Google =  get_plusones($pageURL);\r\n\r\n#Get Number of Stumbleupon Shares\r\nfunction get_stumbleupon($url) {    \r\n  $json_string = file_get_contents(\"http:\/\/www.stumbleupon.com\/services\/1.01\/badge.getinfo?url=$url&amp;format=json\");\r\n  $json = json_decode($json_string, true); \r\n  return intval( $json['result']['views'] );\r\n}\r\n$count_Stumbleupon =  get_stumbleupon($stmbleURL);\r\n\r\n#Get Number of Reddit Shares\r\nfunction get_reddit($url) {    \r\n  $json_string = file_get_contents('http:\/\/buttons.reddit.com\/button_info.json?url='.$url);\r\n  $json = json_decode($json_string, true);\r\n  return intval( $json['data']['children']['0']['data']['ups'] );\r\n}\r\n$count_Reddit =  get_reddit($encodedPageUrl);\r\n\r\n#Get Number of Delicious Shares\r\nfunction get_delicious($url) {    \r\n  $json_string = file_get_contents('http:\/\/feeds.delicious.com\/v2\/json\/urlinfo\/data?url='.$url);\r\n  $json = json_decode($json_string, true);\r\n  return intval( $json['0']['total_posts']);\r\n}\r\n$count_Delicious =  get_delicious($encodedPageUrl);\r\n\r\n#Get Number of Pinterest Shares\r\n$get_pinterest = json_decode(preg_replace('\/^receiveCount\\((.*)\\)$\/', \"\\\\1\",file_get_contents('http:\/\/api.pinterest.com\/v1\/urls\/count.json?callback=receiveCount&amp;url='.$shortPageUrl)));\r\n$count_Pinterest = $get_pinterest-&gt;count;\r\nif($count_Pinterest=='-')\r\n{\r\n\t$count_Pinterest=0;\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Simplest way to put the share count of your website url. There having various social media website where you want share your website page. Here is the the Demo code of getting share count of your share page. $uri = &amp; JFactory::getURI(); $pageURL = $uri-&gt;toString(); $encodedPageUrl=urlencode($pageURL); # URL for Stumbleupon $stumbleuponURL = str_replace(&#8216;http:\/\/&#8217;,&#8221;,$pageURL); $shortPageUrlStumble=urlencode($stumbleuponURL); $stmbleURL <a href=\"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,234],"tags":[],"class_list":["post-1285","post","type-post","status-publish","format-standard","hentry","category-joomla-2","category-social-media"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Popular Social Media Share Count on your website - Webkul Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Popular Social Media Share Count on your website - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Simplest way to put the share count of your website url. There having various social media website where you want share your website page. Here is the the Demo code of getting share count of your share page. $uri = &amp; JFactory::getURI(); $pageURL = $uri-&gt;toString(); $encodedPageUrl=urlencode($pageURL); # URL for Stumbleupon $stumbleuponURL = str_replace(&#039;http:\/\/&#039;,&#039;&#039;,$pageURL); $shortPageUrlStumble=urlencode($stumbleuponURL); $stmbleURL [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2013-01-17T11:25:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-01-17T15:05:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Sandeep\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sandeep\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/\"},\"author\":{\"name\":\"Sandeep\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/53c1b6c4937da7467b0493e192cba16e\"},\"headline\":\"Popular Social Media Share Count on your website\",\"datePublished\":\"2013-01-17T11:25:44+00:00\",\"dateModified\":\"2013-01-17T15:05:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/\"},\"wordCount\":47,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"articleSection\":[\"Joomla\",\"social media\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/\",\"url\":\"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/\",\"name\":\"Popular Social Media Share Count on your website - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"datePublished\":\"2013-01-17T11:25:44+00:00\",\"dateModified\":\"2013-01-17T15:05:08+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Popular Social Media Share Count on your website\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/53c1b6c4937da7467b0493e192cba16e\",\"name\":\"Sandeep\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5beff2e054be0f90faa52b0b165374035b9d3f1ffa505dc3bfa0a1ac969bbbf2?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5beff2e054be0f90faa52b0b165374035b9d3f1ffa505dc3bfa0a1ac969bbbf2?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Sandeep\"},\"sameAs\":[\"http:\/\/webkul.com\"],\"url\":\"https:\/\/webkul.com\/blog\/author\/sandeep\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Popular Social Media Share Count on your website - Webkul Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/","og_locale":"en_US","og_type":"article","og_title":"Popular Social Media Share Count on your website - Webkul Blog","og_description":"Simplest way to put the share count of your website url. There having various social media website where you want share your website page. Here is the the Demo code of getting share count of your share page. $uri = &amp; JFactory::getURI(); $pageURL = $uri-&gt;toString(); $encodedPageUrl=urlencode($pageURL); # URL for Stumbleupon $stumbleuponURL = str_replace('http:\/\/','',$pageURL); $shortPageUrlStumble=urlencode($stumbleuponURL); $stmbleURL [...]","og_url":"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2013-01-17T11:25:44+00:00","article_modified_time":"2013-01-17T15:05:08+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png","type":"image\/png"}],"author":"Sandeep","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Sandeep","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/"},"author":{"name":"Sandeep","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/53c1b6c4937da7467b0493e192cba16e"},"headline":"Popular Social Media Share Count on your website","datePublished":"2013-01-17T11:25:44+00:00","dateModified":"2013-01-17T15:05:08+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/"},"wordCount":47,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"articleSection":["Joomla","social media"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/","url":"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/","name":"Popular Social Media Share Count on your website - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"datePublished":"2013-01-17T11:25:44+00:00","dateModified":"2013-01-17T15:05:08+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/popular-social-media-share-count-on-your-website\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Popular Social Media Share Count on your website"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/53c1b6c4937da7467b0493e192cba16e","name":"Sandeep","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5beff2e054be0f90faa52b0b165374035b9d3f1ffa505dc3bfa0a1ac969bbbf2?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5beff2e054be0f90faa52b0b165374035b9d3f1ffa505dc3bfa0a1ac969bbbf2?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Sandeep"},"sameAs":["http:\/\/webkul.com"],"url":"https:\/\/webkul.com\/blog\/author\/sandeep\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/1285","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=1285"}],"version-history":[{"count":6,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/1285\/revisions"}],"predecessor-version":[{"id":1287,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/1285\/revisions\/1287"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=1285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=1285"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=1285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}