I’ve been trying to code my own keyword position ranking scanner for SEO purposes. I found a PHP class that looks like it will be very helpful but I can’t figure out how to get it working.
I’m fairly new to using classes/functions with PHP.
This is the code I found:
http://www.andreyvoev.com/programming/simple-serp-tracker-php-class/
I’ve copied and pasted it exactly and it’s still not working. Would someone be willing to explain it to me?
EDIT
What I ended up doing was put the whole thing in one script, I have the class at the beginning of the script along with the class GoogleTracker and then I have the bit that runs it.
$test = new GoogleTracker(array ('lsp'), 'adventuretime.wikia.com', 50);
//$test->use_proxy('proxy.txt');
$test->run();
$results = $test->get_results();
// $debug = $test->get_debug_info();
print $results;
//print_r($debug);
And when I run it in my browser the only that that prints is
Array()
Am I doing something wrong or is it the script?
I don’t know why it took me so long to see this.. yes, you are doing something wrong. You are attempting to convert an array to a string.
This does not work with a normal
print()function, as it expects a string as input.. not a mixed variable. To view the results, you either wantprint_r(), or to look at the array key directly: