PHP Classes

google webmaster tools class problem

Recommend this page to a friend!

      PHP OAuth Library  >  PHP OAuth Library package blog  >  How to Implement PHP ...  >  All threads  >  google webmaster tools class problem  >  (Un) Subscribe thread alerts  
Subject:google webmaster tools class problem
Summary:I get 403 error when trying to log in
Messages:8
Author:Robert Nagy
Date:2014-12-01 13:22:12
 

  1. google webmaster tools class problem   Reply   Report abuse  
Picture of Robert Nagy Robert Nagy - 2014-12-01 13:22:12
I am getting 403 error when trying to use this class. I got an emai from google where they toldme that access was denied and that if I want to use this app/software to login I have to enable "less secure apps".
I enabled them, but I go on getting 403 error...why?

Is there any start-up opration/configuration to do?
I have just copied all required classes in the folder together with the example cript top_pages_example.php

  2. Re: google webmaster tools class problem   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-12-01 17:34:46 - In reply to message 1 from Robert Nagy
I am not sure what code you are using.

The other Webmaster Tools package is not using OAuth yet.

What code are you using to call Webmaster Tools API?

  3. Re: google webmaster tools class problem   Reply   Report abuse  
Picture of Robert Nagy Robert Nagy - 2014-12-01 17:43:31 - In reply to message 1 from Robert Nagy
<?php
/*
* access_top_pages.php
*
* @(#) $Id: access_top_pages.php,v 1.3 2013/07/16 12:36:48 mlemos Exp $
*
*/

require('wmt/http.php');
require('wmt/oauth_client.php');
require('wmt/xml_parser.php');
require('wmt/web_master_tools.php');
require('wmt/forms.php');
require('wmt/form_layout_vertical.php');
require('wmt/top_pages.php');

$top_pages = new top_pages_class;
if(($success = $top_pages->Initialize()))
$success = $top_pages->Finalize($top_pages->Process());
if($top_pages->exit)
exit;
if($success)
$top_pages->Output();
else
{
?>
<h1>Top pages error</h1>
<pre>Error: <?php echo HtmlSpecialChars($top_pages->error); ?></pre>
<?php
}
?>

  4. Re: google webmaster tools class problem   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-12-01 19:20:57 - In reply to message 3 from Robert Nagy
The inclusion of the OAuth class there is not needed because the class does not use OAuth for now.

Google released Webmaster Tools API 2 with OAuth support but since the necessary API calls are not yet documented, this class still uses the old version 1 API which does not rely on OAuth.

Those errors you are getting must be something like you are trying to login with a user without permissions. Try setting the debug variable to true and check your PHP error logs files to see what messages appear there for more hints about your problem.

  5. Re: google webmaster tools class problem   Reply   Report abuse  
Picture of Robert Nagy Robert Nagy - 2014-12-01 20:05:54 - In reply to message 4 from Manuel Lemos
I'm getting 403 error

[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: Connecting to www.google.com, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: Resolving HTTP server domain "www.google.com"..., referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: Connecting to HTTP server IP 173.194.113.52 port 443..., referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: Connected to www.google.com, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: C POST /accounts/ClientLogin HTTP/1.1, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: C Host: www.google.com, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: C User-Agent: httpclient (http://www.phpclasses.org/httpclient $Revision: 1.92 $), referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: C Connection: Keep-Alive, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: C Content-Type: application/x-www-form-urlencoded, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: C Content-Length: 136, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: C , referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: C accountType=HOSTED_OR_GOOGLE&Email=robert72%40dublin.com&Passwd=XXX&service=sitemaps&source=Manuel+Lemos-Webmaster+Tools+Client-1.0, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S HTTP/1.1 403 Forbidden, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S Content-Type: text/plain, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S X-Frame-Options: DENY, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S Cache-control: no-cache, no-store, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S Pragma: no-cache, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S Expires: Mon, 01-Jan-1990 00:00:00 GMT, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S Date: Mon, 01 Dec 2014 19:59:01 GMT, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S X-Content-Type-Options: nosniff, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S X-XSS-Protection: 1; mode=block, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S Content-Length: 341, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S Server: GSE, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S Alternate-Protocol: 443:quic,p=0.02, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S , referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: Disconnected from www.google.com, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php

  6. Re: google webmaster tools class problem   Reply   Report abuse  
Picture of Robert Nagy Robert Nagy - 2014-12-01 21:30:18 - In reply to message 4 from Manuel Lemos
Everytime I try to access I get an email from google "somebody has tried to access your account" and in the account activities I find this:


Someone has your password. Google prevented the sign-in. Learn more
Unknown device
Time: Just now
Location: Netherlands
IP address: IP OF THE SERVER


©2014 Google -
Terms of Use
Approximate location (may include nearby towns)
Do you recognize this activity? If not, someone else might have your password.

  7. Re: google webmaster tools class problem   Reply   Report abuse  
Picture of Robert Nagy Robert Nagy - 2014-12-01 21:35:21 - In reply to message 6 from Robert Nagy
solved:

I had to open this page:
accounts.google.com/DisplayUnlockCa ...

after that, I had 10 mnutes to login, and this time login was allowed

  8. Re: google webmaster tools class problem   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-12-02 02:24:54 - In reply to message 7 from Robert Nagy
Good, I remember I had that problem too.

Anyway, future versions will use OAuth 2 and so do not have that problem. We just need to wait for Google to add those features to Webmaster Tools API V2.