Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
78153fa
commit 6a426b6
Showing
2 changed files
with
137 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
The MIT License (http://eyecatchup.mit-license.org/) | ||
Copyright � 2012 Stephan Schmitz, https://github.com/eyecatchup <eyecatchup@gmail.com> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the �Software�), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED �AS IS�, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,129 @@ | ||
GWT_CrawlErrors-php | ||
=================== | ||
# GwtCrawlErrors: Download website crawl errors from Google Webmaster Tools as CSV. | ||
|
||
## Introduction | ||
|
||
This project provides an easy way to automate downloading of crawl errors from Google Webmaster Tools. | ||
|
||
## Usage | ||
|
||
This document explains how to automate the file download process from Google Webmaster Tools by showing examples for using the php class `GwtCrawlErrors`. | ||
|
||
### Get started | ||
|
||
To get started, the steps are as follows: | ||
|
||
- Download the php file <a target="_blank" href="https://raw.github.com/eyecatchup/GWT_CrawlErrors-php/master/GwtCrawlErrors.class.php.php">`GwtCrawlErrors.class.php`</a>. | ||
- Create a folder and add the <a target="_blank" href="https://raw.github.com/eyecatchup/GWT_CrawlErrors-php/master/GwtCrawlErrors.class.php.php">`GwtCrawlErrors.class.php`</a> script to it. | ||
|
||
### Example 1 - Download via browser | ||
|
||
To download CSV data for a single domain name via a web browser, the steps are as follows: | ||
|
||
- In the same folder where you added the `GwtCrawlErrors.class.php`, create and run the following PHP script.<br>_You'll need to replace the example values for "mail" and "pass" with valid login details for your Google Account and for "domain" with a valid URL for a site registered in your GWT account._ | ||
|
||
```php | ||
<?php | ||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'GwtCrawlErrors.class.php'; | ||
|
||
/** | ||
* Example 1: | ||
* Download a CSV for a specific domain from the browser. | ||
*/ | ||
try { | ||
$mail = 'eyecatchup@gmail.com'; | ||
$pass = '********'; | ||
|
||
$domain = 'http://www.domain.tld/'; // must have trailing slash! | ||
|
||
$gwtCrawlErrors = new GwtCrawlErrors(); | ||
|
||
if ($gwtCrawlErrors->login($mail, $pass)) { | ||
// force download in browser (using http headers) | ||
$gwtCrawlErrors->getCsv($domain); | ||
} | ||
} | ||
catch (Exception $e) { | ||
die($e->getMessage()); | ||
} | ||
``` | ||
|
||
This will force a download in your browser (using HTTP headers) to download one CSV file named `gwt-crawlerrors-www.domain.com-YYYYmmdd-H:i:s.csv`. | ||
|
||
|
||
### Example 2 - Download to filesystem | ||
|
||
To download CSV data for a single domain name directly to the local file system (eg. when executing from command line), the steps are as follows: | ||
|
||
- In the same folder where you added the `GwtCrawlErrors.class.php`, create and run the following PHP script.<br>_You'll need to replace the example values for "mail" and "pass" with valid login details for your Google Account and for "domain" with a valid URL for a site registered in your GWT account._ | ||
|
||
```php | ||
<?php | ||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'GwtCrawlErrors.class.php'; | ||
|
||
/** | ||
* Example 2: | ||
* Save a CSV for a specific domain to a specific local path. | ||
*/ | ||
try { | ||
$mail = 'eyecatchup@gmail.com'; | ||
$pass = '********'; | ||
|
||
$domain = 'http://www.domain.tld/'; // must have trailing slash! | ||
|
||
$gwtCrawlErrors = new GwtCrawlErrors(); | ||
|
||
if ($gwtCrawlErrors->login($mail, $pass)) { | ||
// save the crawl errors to a local path | ||
$gwtCrawlErrors->getCsv($domain, __DIR__); | ||
} | ||
} | ||
catch (Exception $e) { | ||
die($e->getMessage()); | ||
} | ||
``` | ||
|
||
This will create one CSV file named `gwt-crawlerrors-www.domain.com-YYYYmmdd-H:i:s.csv` in the specified path. | ||
|
||
|
||
### Example 3 - Bulk downloads | ||
|
||
To download CSV data for each domain connected to the Google WMT account to the local file system (eg. when executing from command line), the steps are as follows: | ||
|
||
- In the same folder where you added the `GwtCrawlErrors.class.php`, create and run the following PHP script.<br>_You'll need to replace the example values for "mail" and "pass" with valid login details for your Google Account and for "domain" with a valid URL for a site registered in your GWT account._ | ||
|
||
```php | ||
<?php | ||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'GwtCrawlErrors.class.php'; | ||
|
||
/** | ||
* Example 3: | ||
* Save a CSV for each domain connected to the GWT account | ||
* to a specific local path. | ||
*/ | ||
try { | ||
$mail = 'eyecatchup@gmail.com'; | ||
$pass = '********'; | ||
|
||
$gwtCrawlErrors = new GwtCrawlErrors(); | ||
|
||
if ($gwtCrawlErrors->login($mail, $pass)) { | ||
// iterate over all connected domains | ||
$sites = $gwtCrawlErrors->getSites(); | ||
foreach($sites as $domain) { | ||
$gwtCrawlErrors->getCsv($domain, __DIR__); | ||
} | ||
|
||
} | ||
} | ||
catch (Exception $e) { | ||
die($e->getMessage()); | ||
} | ||
``` | ||
|
||
This will create a CSV file named `gwt-crawlerrors-www.domain.com-YYYYmmdd-H:i:s.csv`, for each domain connected to the Google WMT account, in the specified path. | ||
|
||
## License | ||
|
||
(c) 2013 - now, Stephan Schmitz eyecatchup@gmail.com | ||
License: MIT, http://eyecatchup.mit-license.org | ||
URL: https://github.com/eyecatchup/GWT_CrawlErrors-php |