Example #1
0
         $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;
         //}
     }
 } catch (SEOstatsException $e) {
Example #2
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\SemRush;
try {
    $url = 'http://www.google.de/';
    // Create a new SEOstats instance.
    $seostats = new \SEOstats\SEOstats();
    // Bind the URL to the current SEOstats instance.
    if ($seostats->setUrl($url)) {
        /**
         *  Get the current SEMrush DomainRank metrics for the given URL.
         */
        print_r(SemRush::getDomainRank());
        /**
         *  Get historical SEMrush DomainRank metrics for the given URL.
         */
        //print_r(SemRush::getDomainRankHistory());
        /**
         *  Get competing domains for the given URL
         *  and their basic SEMrush DomainRank metrics.
         */
        //print_r(SemRush::getCompetitors());
        /**
         *  Get organic search engine traffic data for the given URL.
         */
        //print_r(SEMrush::getOrganicKeywords());
        /**
         *  Get organic search engine traffic metrics for the given URL,
Example #3
0
    if ($seostats->setUrl($url)) {
        /**
         *  Print HTML code for the 'search engine traffic'-graph.
         */
        echo SemRush::getDomainGraph(1);
        /**
         *  Print HTML code for the 'search engine traffic price'-graph.
         */
        echo SemRush::getDomainGraph(2);
        /**
         *  Print HTML code for the 'number of adwords ads'-graph,
         *  using explicitly SEMRush's data for google.de (german index).
         */
        echo SemRush::getDomainGraph(3, false, 'de');
        /**
         *  Print HTML code for the 'adwords traffic'-graph, using
         *  explicitly SEMRush's data for google.de (german index)
         *  and specific graph dimensions of 320*240 px.
         */
        echo SemRush::getDomainGraph(4, false, 'de', 320, 240);
        /**
         *  Print HTML code for the 'adwords traffic price'-graph,
         *  using explicitly SEMRush's data for google.de (german index),
         *  specific graph dimensions of 320*240 px and specific
         *  graph colors (black lines and red dots for data points).
         */
        echo SemRush::getDomainGraph(5, false, 'de', 320, 240, '000000', 'ff0000');
    }
} catch (\Exception $e) {
    echo 'Caught SEOstatsException: ' . $e->getMessage();
}