Skip to content

Instantly share code, notes, and snippets.

@eyecatchup
Created August 22, 2013 17:18
Show Gist options
  • Save eyecatchup/6310152 to your computer and use it in GitHub Desktop.
Save eyecatchup/6310152 to your computer and use it in GitHub Desktop.
<?php
/**
* SEOstats Example - Get SEMrush Metrics as Graphs (nonstatic)
*
* @package SEOstats
* @author Stephan Schmitz <eyecatchup@gmail.com>
* @copyright Copyright (c) 2010 - present Stephan Schmitz
* @license http://eyecatchup.mit-license.org/ MIT License
* @updated 2013/08/17
*/
// Bootstrap the library / register autoloader
require_once (__DIR__ . '\..') . '\SEOstats\bootstrap.php';
try {
$url = 'http://www.nahklick.de/';
$seostats = new \SEOstats\SEOstats;
$semrush = $seostats->SEMRush();
// Bind the URL to the current SEOstats instance.
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();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment