PHP code example of linpar / socialshare

1. Go to this page and download the library: Download linpar/socialshare library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

linpar / socialshare example snippets


// somewhere early in your project's loading, d

$socialShare = new SocialShare(API_KEY);
print_r('<pre>');
print_r($socialShare->facebook->shares(array('http://github.com'))); // Replace facebook with twitter to calculate shares on Twitter
print_r($socialShare->facebook->clicks(array('http://github.com')));
print_r($socialShare->facebook->comments(array('http://github.com')));
print_r($socialShare->facebook->likes(array('http://github.com')));

$socialShare = new SocialShare(API_KEY);
print_r('<pre>');
print_r($socialShare->facebook->shares(array('http://github.com', 'http://google.com'))); // Replace facebook with twitter to calculate shares on Twitter
print_r($socialShare->facebook->clicks(array('http://github.com', 'http://google.com')));
print_r($socialShare->facebook->comments(array('http://github.com', 'http://google.com')));
print_r($socialShare->facebook->likes(array('http://github.com', 'http://google.com')));

$socialShare = new SocialShare(API_KEY);
print_r('<pre>');
print_r($socialShare->facebook->totalShares(array('http://github.com', 'http://google.com')) ."\n"); // Replace facebook with twitter to calculate shares on Twitter
print_r($socialShare->facebook->totalClicks(array('http://github.com', 'http://google.com')) ."\n");
print_r($socialShare->facebook->totalComments(array('http://github.com', 'http://google.com')) ."\n");
print_r($socialShare->facebook->totalLikes(array('http://github.com', 'http://google.com')) ."\n");
bash
$ curl -sS http://getcomposer.org/installer | php
$ php composer.phar update