eyecatchup/SEOstats

Class not found

Closed this issue · 6 comments

In the get-semrush-metrics.php example I get the following error:

Fatal error: Class 'SEOstats\Services\SEMRush' not found

Note: To get the code past a fatal error on the require_once, I had to change it to this:
require_once ($_SERVER['DOCUMENT_ROOT'] . '/SEOstats/bootstrap.php');

Also, very new PHP namespaces and use statements. My version of Dreamweaver flags them as incorrect syntax.

require etc are statements, no functions. Thus, you shouldn't use brackets. Does Dreamweaver flag this as incorrect as well? ;-)

The problem is probably due to the use of backslashes instead of slashes in the example files - which works fine on Windows, but on *nix.

Your should be able to solve that by changing this line in the example files

require_once (__DIR__ . '\..') . '\SEOstats\bootstrap.php';
to
require_once (__DIR__ . '/..') . '/SEOstats/bootstrap.php';

The upcoming release uses the PHP constant DIRECTORY_SEPERATOR to fix that (see issue #36).

Closing this issue.

I replaced that line. I still get the error:

Fatal error: Class 'SEOstats\Services\SEMRush' not found

from this line:

print_r(SEMrush::getDomainRank());

I didn't get a response to my comment, so I created a new issue, thinking that my commenting on a closed issue was incorrect.

Please take a look at my comment and provide a course of action for debugging or a fix.

Please provide some more details (PHP version, System, OS..). I'll check on it later

Please take a look at my comment and provide a course of action for debugging or a fix.

Maybe you should learn how to ask smart questions and how to provide bug reports before trolling around.

PHP 5.4.18
Quad Core Intel(R) Xeon(R) CPU E31220 @ 3.10GHz with 12Gb RAM
CentOS release 6.3

Just trying to get this done quickly. It's probably something simple.