Exemple #1
0
 /**
  * Returns the internal ID, the Facebook Graph API registers to - and uses for identifying - a Domain.
  *
  * @access		  public
  * @link		  http://developers.facebook.com/docs/reference/api/domain/
  * @param   host  string  	 The URL to get the ID for.
  * @return        integer    Returns 0, or the unique Domain-ID.
  */
 public static function fbGraphApiIdByHost($host)
 {
     $url = 'http://graph.facebook.com/?domain=' . $host;
     $str = SEOstats::cURL($url);
     $obj = json_decode($str);
     return isset($obj->id) && $obj->id != NULL ? $obj->id : intval('0');
 }
Exemple #2
0
 /**
  * Returns the total amount of Backlinks indexed at Yahoo!
  *
  * @access		private
  * @link 		http://developer.yahoo.com/search/siteexplorer/		Get your own application ID here
  * @return		integer 				Returns the total amount of backlinks indexed at Yahoo!
  */
 public static function yahooBacklinksTotal($uri)
 {
     $url = 'http://search.yahooapis.com/SiteExplorerService/V1/inlinkData?appid=';
     $url .= YAHOO_APP_ID;
     $url .= '&results=1&output=json&query=http://' . urlencode($uri);
     $str = SEOstats::cURL($url);
     $data = json_decode($str);
     return $data->ResultSet->totalResultsAvailable;
 }
 /**
  * Gets domain and URL authority from SEOmoz.
  *
  * @access		private
  * @link 		http://www.seomoz.org/api		The SEOmoz API
  * @return		array 					Returns array, containing authority data.
  */
 public static function Seomoz_Authority($uri)
 {
     // external helper class
     include_once 'ext/SeoMoz/Authenticator.php';
     $authenticator = new Authenticator();
     $url = urlencode($uri);
     $tmp = SEOstats::cURL('http://lsapi.seomoz.com/linkscape/url-metrics/' . $url . '?' . $authenticator->getAuthenticationStr());
     $data = json_decode($tmp);
     $result = array('Title' => $data->ut, 'URL' => $data->uu, 'External Links' => $data->ueid, 'Links' => $data->uid, 'URL Authority' => $data->upa, 'URL mozRank' => $data->umrp, 'Subdomain mozRank' => $data->fmrp, 'HTTP Status Code' => $data->us, 'Page Authority' => $data->upa, 'Domain Authority' => $data->pda);
     return $result;
 }
 /**
  * Returns the total amount of twitter mentions for entire domain
  *
  * @access       public
  * @param   uri  string             The URI to check.
  * @return       integer            Returns the total of twitter mentions for the entire domain.
  */
 public static function backtweets($uri)
 {
     $tmp = SEOstats::cURL('http://backtweets.com/search?q=' . $uri);
     $dom = new DOMDocument();
     @$dom->loadHTML($tmp);
     $xpath = new DOMXPath($dom);
     $p = $xpath->query('//div/ol/li');
     $r = $p->item(2)->textContent;
     $r = str_replace(',', '', $r);
     $r = str_replace('Results', '', $r);
     $r = str_replace('Result', '', $r);
     $r = trim($r);
     return $r != '' ? $r : intval('0');
 }
 /**
  * Returns array, containing details about the pages indexed at Bing
  *
  * @access       public
  * @link         http://www.bing.com:80/developers/        Get your own application ID here
  * @return       array                     Returns array, containing details about the pages indexed at Bing
  */
 public static function bingSiteindexArray($uri)
 {
     $url = 'http://api.bing.net/json.aspx?&Version=2.2&Market=en-US&Sources=web&Web.Count=50&JsonType=function';
     $url .= '&AppId=' . BING_APP_ID;
     $url .= '&Query=site:' . urlencode($uri);
     $str = SEOstats::cURL($url);
     $str = str_ireplace("function BingGetResponse(){return", "", $str);
     $str = str_ireplace("; /* pageview_candidate */}", "", $str);
     $data = json_decode($str);
     $result = array();
     foreach ($data->SearchResponse->Web->Results as $entry) {
         $result[] = array('Title' => $entry->Title, 'URL' => $entry->DisplayUrl, 'Click URL' => $entry->Url);
     }
     return $result;
 }
<?php

ini_set('max_execution_time', 180);
include '../src/class.seostats.php';
try {
    $url = new SEOstats($_GET['url']);
    echo $url->Google_Pagespeed_Score();
} catch (SEOstatsException $e) {
    /**
     * Error handling (print it, log it, leave it.. whatever you want.)
     */
    die($e->getMessage());
}
 /**
  * Gets the Google Pagerank
  *
  * @access        private
  * @return        integer                    Returns the Google PageRank.
  */
 public static function Google_PR($host)
 {
     $domain = 'http://' . $host;
     if (USE_PAGERANK_CHECKSUM_API == true) {
         $str = SEOstats::cURL(SEOstats::PAGERANK_CHECKSUM_API_URI . $domain);
         $data = json_decode($str);
         $checksum = $data->CH;
     } else {
         $checksum = self::genhash($domain);
     }
     $googleurl = 'http://toolbarqueries.google.com/tbr?features=Rank&sourceid=navclient-ff&client=navclient-auto-ff';
     $googleurl .= '&googleip=O;66.249.81.104;104&ch=' . $checksum . '&q=info:' . urlencode($domain);
     $out = SEOstats::cURL($googleurl);
     $pagerank = trim(substr($out, 9));
     if (!preg_match('/^[0-9]/', $pagerank)) {
         $pagerank = 'Failed to generate a valid hash for PR check.';
     }
     return $pagerank;
 }
<?php

ini_set('max_execution_time', 180);
include '../src/class.seostats.php';
try {
    $url = new SEOstats($_GET['url']);
    $url->print_array('All_Totals');
} catch (SEOstatsException $e) {
    /**
     * Error handling (print it, log it, leave it.. whatever you want.)
     */
    die($e->getMessage());
}
<?php

ini_set('max_execution_time', 180);
include '../src/class.seostats.php';
try {
    $url = new SEOstats($_GET['url']);
    echo $url->Alexa_Avg_Load_Time();
} catch (SEOstatsException $e) {
    /**
     * Error handling (print it, log it, leave it.. whatever you want.)
     */
    die($e->getMessage());
}
<?php

ini_set('max_execution_time', 180);
include '../src/class.seostats.php';
try {
    $url = new SEOstats($_GET['url']);
    print_r($url->Yahoo());
} catch (SEOstatsException $e) {
    /**
     * Error handling (print it, log it, leave it.. whatever you want.)
     */
    die($e->getMessage());
}
Exemple #11
0
<?php

ini_set('max_execution_time', 300);
require '../src/seostats.php';
try {
    $url = "http://www.nahklick.de";
    /**
     * Create a new SEOstats object to request SEO metrics
     * for the given URL.
     */
    $seostats = new SEOstats($url);
    ?>
<!--
    Demo output for the SEOstats result data.
-->
<style>td{padding: 3px 5px; border:1px solid #999;}</style>
<table>
    <!-- ALEXA -->
    <?php 
    // create a new object to request alexa metrics
    $alexa = $seostats->Alexa();
    ?>
    <tr>
        <td colspan="2" style="text-align:center;font-weight:bold;">Alexa</td>
    </tr>
    <tr>
        <td>Global Domain-Rank</td>
        <td><?php 
    print $alexa->getGlobalRank();
    ?>
</td>
Exemple #12
0
 /**
  * Helper. Get the Alexa's free report webpage.
  *
  * @access		private
  * @return 		string 					String, containing the curl result of the the Alexa webpage.
  */
 private static function _alexa($uri)
 {
     $tmp = SEOstats::cURL('http://www.alexa.com/siteinfo/' . $uri);
     return $tmp;
 }
<?php

ini_set('max_execution_time', 180);
include '../src/class.seostats.php';
try {
    $url = new SEOstats($_GET['url']);
    $url->print_array('Google', 'json');
} catch (SEOstatsException $e) {
    /**
     * Error handling (print it, log it, leave it.. whatever you want.)
     */
    die($e->getMessage());
}
Exemple #14
0
<?php

ini_set('max_execution_time', 180);
include '../src/class.seostats.php';
try {
    $url = new SEOstats($_GET['url']);
    $url->print_array('Alexa_Visits_By_Country');
} catch (SEOstatsException $e) {
    /**
     * Error handling (print it, log it, leave it.. whatever you want.)
     */
    die($e->getMessage());
}
Exemple #15
0
 public function setUrl($url)
 {
     self::$_url = $url;
 }
<?php

ini_set('max_execution_time', 180);
include '../src/class.seostats.php';
try {
    $url = new SEOstats($_GET['url']);
    $url->print_array('Bing_Siteindex_Array');
} catch (SEOstatsException $e) {
    /**
     * Error handling (print it, log it, leave it.. whatever you want.)
     */
    die($e->getMessage());
}