Exemple #1
0
 $linked_pages = $row[2];
 // Bind the URL to the current SEOstats instance.
 if ($seostats->setUrl($url)) {
     //-------------------------------------------------------------------------------------------------------------------------------|
     //-----if you start getting a bunch of 0's or NA's, remember that there are pretty low limits to Alexa and Google calls...-------|
     //-------------------------------------------------------------------------------------------------------------------------------|
     $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;
     //}
Exemple #2
0
    // Bind the URL to the current SEOstats instance.
    if ($seostats->setUrl($url)) {
        /**
         *  Print HTML code for the 'daily traffic trend'-graph.
         */
        echo Alexa::getTrafficGraph(1);
        /**
         *  Print HTML code for the 'daily pageviews (percent)'-graph.
         */
        echo Alexa::getTrafficGraph(2);
        /**
         *  Print HTML code for the 'daily pageviews per user'-graph.
         */
        echo Alexa::getTrafficGraph(3);
        /**
         *  Print HTML code for the 'time on site (in minutes)'-graph.
         */
        echo Alexa::getTrafficGraph(4);
        /**
         *  Print HTML code for the 'bounce rate (percent)'-graph.
         */
        echo Alexa::getTrafficGraph(5);
        /**
         *  Print HTML code for the 'search visits'-graph, using
         *  specific graph dimensions of 320*240 px.
         */
        echo Alexa::getTrafficGraph(6, false, 320, 240);
    }
} catch (\Exception $e) {
    echo 'Caught SEOstatsException: ' . $e->getMessage();
}