Ejemplo n.º 1
0
// For further reference see: https://github.com/eyecatchup/SEOstats/issues/49
// Bootstrap the library / register autoloader
#require_once realpath(__DIR__ . '/SEOstats/bootstrap.php');
require_once realpath(__DIR__ . '/vendor/autoload.php');
use SEOstats\Services\Social;
try {
    $url = 'http://www.google.com/';
    // Create a new SEOstats instance.
    $seostats = new \SEOstats\SEOstats();
    // Bind the URL to the current SEOstats instance.
    if ($seostats->setUrl($url)) {
        echo "Social network metrics for " . $url . PHP_EOL;
        /**
         *  Get the total count of +1s for $url on Google+.
         */
        echo "Google+ Shares:          " . Social::getGooglePlusShares() . PHP_EOL;
        /**
         *  Get the total count of mentions of $url on Twitter.
         */
        echo "Twitter Shares:          " . Social::getTwitterShares() . PHP_EOL;
        /**
         *  Get interaction counts (shares, likes, comments, clicks) for $url on Facebook.
         */
        echo "Facebook Shares:         ";
        print_r(Social::getFacebookShares());
        /**
         *  Get the total count of shares for $url via VKontakte.
         */
        echo "VKontakte Shares:        " . Social::getVKontakteShares() . PHP_EOL;
        /**
         *  Get the total count of shares for $url via Pinterest.
Ejemplo n.º 2
0
 //-------------------------------------------------------------------------------------------------------------------------------|
 $alexa = SEOstats\Alexa::getGlobalRank();
 $pagerank = SEOstats\Google::getPageRank();
 $g_links = SEOstats\Google::getBacklinksTotal("www." . $row[0]);
 $g_links_no_www = SEOstats\Google::getBacklinksTotal($row[0]);
 $g_plus_count = SEOstats\Social::getGooglePlusShares();
 $twitter_shares = SEOstats\Social::getTwitterShares();
 $linkedin_shares = SEOstats\Social::getLinkedInShares();
 echo "<div class='row'><div class='col-md-12'><h3>" . $row[0] . "</h3>";
 echo "<div class='row'><div class='col-md-7'>Alexa rank = " . SEOstats\Alexa::getGlobalRank() . "<br />";
 echo "Daily traffic graph: " . SEOstats\Alexa::getTrafficGraph(1) . "<br /></div>";
 echo "<div class='col-md-3'>PageRank = " . SEOstats\Google::getPageRank() . "<br />";
 echo "Google links = " . SEOstats\Google::getBacklinksTotal("www." . $row[0]) . "<br />";
 echo "Google links (no www) = " . SEOstats\Google::getBacklinksTotal($row[0]) . "<br />";
 echo "Twitter shares: " . SEOstats\Social::getTwitterShares() . "<br />";
 echo "Plus ones: " . SEOstats\Social::getGooglePlusShares() . "<br />";
 echo "Twitter shares: " . SEOstats\Social::getTwitterShares() . "<br />";
 echo "Linkedin shares: " . SEOstats\Social::getLinkedInShares() . "<br /><br /></div>";
 echo "<div class='col-md-3'>SEMRush Search Engine Traffic Graph: " . SEOstats\SemRush::getDomainGraph(1) . "<br /></div></div></div></div>";
 //----------------------------------------------------------------------------------------|
 //--------------------uncomment this stuff when you want to insert into MySQL!!-----------|
 //----------------------------------------------------------------------------------------|
 /* Prepared statement, stage 1: prepare */
 //if (!($stmt = $mysqli->prepare("INSERT INTO seo (url, alexa, pagerank, link_num, linked_pages, g_links, g_links_no_www, g_plus_ones, linkedin_shares) VALUES (?,?,?,?,?,?,?,?)"))) {
 //	 echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
 //}
 //if (!$stmt->bind_param("siiiiiiii", $url, $alexa, $pagerank, $link_num, $linked_pages, $g_links, $g_links_no_www, $g_plus_ones, $linkedin_shares)) {
 //	 echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
 //}
 //if (!$stmt->execute()) {
 //	 echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;