PHP code example of seostats / seostats

1. Go to this page and download the library: Download seostats/seostats 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/ */

    

seostats / seostats example snippets



// Depending on how you installed SEOstats
#dor' . DIRECTORY_SEPARATOR . 'autoload.php';

use \SEOstats\Services as SEOstats;

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 SEOstats\Alexa::getGlobalRank();
	echo SEOstats\Google::getPageRank();
  }
}
catch (SEOstatsException $e) {
  die($e->getMessage());
}


// Depending on how you installed SEOstats
#dor' . DIRECTORY_SEPARATOR . 'autoload.php';

try {
  $url = 'http://www.google.com/';

  // Get the Google Toolbar Pagerank for the given URL.
  echo \SEOstats\Services\Google::getPageRank($url);
}
catch (SEOstatsException $e) {
  die($e->getMessage());
}


  // Returns the global Alexa Traffic Rank (last 3 months).
  print Alexa::getGlobalRank();

  // Returns the global Traffic Rank for the last month.
  print Alexa::getMonthlyRank();

  // Returns the global Traffic Rank for the last week.
  print Alexa::getWeeklyRank();

  // Returns the global Traffic Rank for yesterday.
  print Alexa::getDailyRank();

  // Returns the country-specific Alexa Traffic Rank.
  print_r( Alexa::getCountryRank() );

  // Returns Alexa's backlink count for the given domain.
  print Alexa::getBacklinkCount();

  // Returns Alexa's page load time info for the given domain.
  print Alexa::getPageLoadTime();


  // Returns HTML code for the 'daily traffic trend'-graph.
  print Alexa::getTrafficGraph(1);

  // Returns HTML code for the 'daily pageviews (percent)'-graph.
  print Alexa::getTrafficGraph(2);

  // Returns HTML code for the 'daily pageviews per user'-graph.
  print Alexa::getTrafficGraph(3);

  // Returns HTML code for the 'time on site (in minutes)'-graph.
  print Alexa::getTrafficGraph(4);

  // Returns HTML code for the 'bounce rate (percent)'-graph.
  print Alexa::getTrafficGraph(5);

  // Returns HTML code for the 'search visits'-graph, using specific graph dimensions of 320*240 px.
  print Alexa::getTrafficGraph(6, 0, 320, 240);


  //  Returns the Google PageRank for the given URL.
  print Google::getPageRank();


  // Returns the Google Pagespeed analysis' metrics for the given URL.
  print_r( Google::getPagespeedAnalysis() );

  // Returns the Google Pagespeed analysis' total score.
  print Google::getPagespeedScore();


  // Returns the total amount of results for a Google site-search for the object URL.
  print Google::getSiteindexTotal();

  // Returns the total amount of results for a Google link-search for the object URL.
  print Google::getBacklinksTotal();

  // Returns the total amount of results for a Google search for 'keyword'.
  print Google::getSearchResultsTotal('keyword');


  // Returns an array of URLs and titles for the first 100 results for a Google web search for 'keyword'.
  print_r ( Google::getSerps('keyword') );

  // Returns an array of URLs and titles for the first 200 results for a Google site-search for $url.
  print_r ( Google::getSerps("site:$url", 200) );

  // Returns an array of URLs, titles and position in SERPS for occurrences of $url
  // within the first 1000 results for a Google web search for 'keyword'.
  print_r ( Google::getSerps('keyword', 1000, $url) );


  // The normalized 10-point MozRank score of the URL. 
  print Mozscape::getMozRank();
  
  // The raw MozRank score of the URL.
  print Mozscape::getMozRankRaw();
  
  // The number of links (equity or nonequity or not, internal or external) to the URL.
  print Mozscape::getLinkCount();
  
  // The number of external equity links to the URL (http://apiwiki.moz.com/glossary#equity).
  print Mozscape::getEquityLinkCount();
  
  // A normalized 100-point score representing the likelihood
  // of the URL to rank well in search engine results.  
  print Mozscape::getPageAuthority();
  
  // A normalized 100-point score representing the likelihood
  // of the root domain of the URL to rank well in search engine results.
  print Mozscape::getDomainAuthority();


  // Returns several metrics from Open Site Explorer (by MOZ)
  $ose = OpenSiteExplorer::getPageMetrics();

  // MOZ Domain-Authority Rank - Predicts this domain's ranking potential in the search engines 
  // based on an algorithmic combination of all link metrics.
  print "Domain-Authority:         " .
        $ose->domainAuthority->result . ' (' .      // Int - e.g 42
        $ose->domainAuthority->unit   . ') - ' .    // String - "/100"
        $ose->domainAuthority->descr  . PHP_EOL;    // String - Result value description

  // MOZ Page-Authority Rank - Predicts this page's ranking potential in the search engines 
  // based on an algorithmic combination of all link metrics.
  print "Page-Authority:           " .
        $ose->pageAuthority->result . ' (' .        // Int - e.g 48
        $ose->pageAuthority->unit   . ') - ' .      // String - "/100"
        $ose->pageAuthority->descr  . PHP_EOL;      // String - Result value description

  // Just-Discovered Inbound Links - Number of links to this page found over the past %n days, 
  // indexed within an hour of being shared on Twitter.
  print "Just-Discovered Links:    " .
        $ose->justDiscovered->result . ' (' .       // Int - e.g 140
        $ose->justDiscovered->unit   . ') - ' .     // String - e.g "32 days"
        $ose->justDiscovered->descr  . PHP_EOL;     // String - Result value description

  // Root-Domain Inbound Links - Number of unique root domains (e.g., *.example.com) 
  // containing at least one linking page to this URL.
  print "Linking Root Domains:     " .
        $ose->linkingRootDomains->result . ' (' .   // Int - e.g 210
        $ose->linkingRootDomains->unit   . ') - ' . // String - "Root Domains"
        $ose->linkingRootDomains->descr  . PHP_EOL; // String - Result value description

  // Total Links - All links to this page including internal, external, followed, and nofollowed.
  print "Total Links:              " .
        $ose->totalLinks->result . ' (' .           // Int - e.g 31571
        $ose->totalLinks->unit   . ') - ' .         // String - "Total Links"
        $ose->totalLinks->descr  . PHP_EOL;         // String - Result value description


  // Returns an array containing the SEMRush main report (containing the domain rank history.
  print_r ( SemRush::getDomainRankHistory() );

  // Returns an array containing data for competeing (auto-detected) websites.
  print_r ( SemRush::getCompetitors() );

  // Returns an array containing data about organic search engine traffic, using explicitly SEMRush's german database.
  print_r ( SemRush::getOrganicKeywords(0, 'de') );


  // Returns HTML code for the 'search engine traffic'-graph.
  print SemRush::getDomainGraph(1);

  // Returns HTML code for the 'search engine traffic price'-graph.
  print SemRush::getDomainGraph(2);

  // Returns HTML code for the 'number of adwords ads'-graph, using explicitly SEMRush's german database.
  print SemRush::getDomainGraph(3, 0, 'de');

  // Returns HTML code for the 'adwords traffic'-graph, using explicitly SEMRush's german database and
  // specific graph dimensions of 320*240 px.
  print SemRush::getDomainGraph(4, 0, 'de', 320, 240);

  // Returns HTML code for the 'adwords traffic price '-graph, using explicitly SEMRush's german database,
  // specific graph dimensions of 320*240 px and specific graph colors (black lines and red dots for data points).
  print SemRush::getDomainGraph(5, 0, 'de', 320, 240, '000000', 'ff0000');


  // Returns the Sistrix visibility index
  // @link http://www.sistrix.com/blog/870-sistrix-visibilityindex.html
  print Sistrix::getVisibilityIndex();


  // Returns integer PlusOne count
  print Social::getGooglePlusShares();


  // Returns an array of total counts for overall Facebook interactions count, shares, likes, comments and clicks.
  print_r ( Social::getFacebookShares() );


  // Returns integer tweet count for URL mentions
  print Social::getTwitterShares();


  // Returns the total count of URL shares via Delicious
  print Social::getDeliciousShares();

  // Returns array of top ten delicious tags for a URL
  print_r ( Social::getDeliciousTopTags() );

  // Returns the total count of URL shares via Digg
  print Social::getDiggShares();

  // Returns the total count of URL shares via LinkedIn
  print Social::getLinkedInShares();

  // Returns shares, comments, clicks and reach for the given URL via Xing
  print_r( Social::getXingShares() );

  // Returns the total count of URL shares via Pinterest
  print Social::getPinterestShares();

  // Returns the total count of URL shares via StumbleUpon
  print Social::getStumbleUponShares();

  // Returns the total count of URL shares via VKontakte
  print Social::getVKontakteShares();