Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- neha rathi
September 24, 2010, 6:25 am
rate this thread
My trying a code to get page visits of all domains of my google
analytics account. My code is running properly on local xampp server &
i am getting visits for all domains but when i run the same code on
dedicated server. It gives me error as
Fatal error: Uncaught exception 'Exception' with message 'Permission
Denied - <HTML> <HEAD> <TITLE>Token invalid</TITLE> </HEAD> <BODY
BGCOLOR="#FFFFFF" TEXT="#000000"> <H1>Token invalid</H1> <H2>Error
401</H2> </BODY> </HTML> ' in /home/gauravhm/public_html/seo/admin/
domain_add/googleanalytics.class.php:274 Stack trace: #0 /home/
www.goo...', Array, Array) #1 /home/gauravhm/public_html/seo/admin/
admin/domain_add/visits.php(76): GoogleAnalytics->getReport(Array) #3
thrown in /home/gauravhm/public_html/seo/admin/domain_add/
googleanalytics.class.php on line 274
I am not understanding why this is happening? I echoed the responce of
google analytics API then I am getting 'http_code' == 200 on local but
401 on dedicated server.
curl is also properly installed..It showing curl is activated on local
& server also properly.
Can somebody please help.
Re: Tokan error & 401 fatal error while running google analytics API code on dedicated server
Read the message: It says, that an exception has been thrown, that you
didn't catch and handle (which is bad coding style).
And the message says: '401 Permission Denied', which means: your
dedicated server is not allowed to:
post to the google analytics url.
I'd say, one of the Array parameters of above method call contains
authentification credentials and those seem to be wrong.