/ Published in: PHP
RankTrackr PHP Snippet | SEO Rank Tracker
This snippet will take search rankings (urls) from your
RankTrackr account (http://ranktrackr.com) and allow
you get data from your tracked urls / keywords.
This snippet will take search rankings (urls) from your
RankTrackr account (http://ranktrackr.com) and allow
you get data from your tracked urls / keywords.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /* RankTrackr PHP Snippet | SEO Rank Tracker This snippet will take search rankings (urls) from your RankTrackr account (http://ranktrackr.com) */ //enable error reporting class RankTrackr { public $token; public $password = 'password'; public $host = 'http://users.ranktrackr.com/api/v1/'; public $ch; public function __construct() { } function get_auth_token() { $query = $this->host . 'token'; CURLOPT_URL => $query, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => "email=$this->username&password=$this->password" )); if (!$data) { return false; } //var_dump( $object ); if ($object && $object->access_token) { $this->token = $object->access_token; } return true; } function get_all_urls() { 'access_token' => $this->token ); CURLOPT_URL => $query, CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true, )); //$info = curl_getinfo($this->ch); if (!$data) { return false; } return $object; } } // Example usage: $ranks = new RankTrackr(); $ranks->get_auth_token(); $ranks->get_all_urls();