Skip to content

Commit

Permalink
Added license file and README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
eyecatchup committed Apr 14, 2013
1 parent 78153fa commit 6a426b6
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 2 deletions.
8 changes: 8 additions & 0 deletions LICENSE
@@ -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.
131 changes: 129 additions & 2 deletions README.md
@@ -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

0 comments on commit 6a426b6

Please sign in to comment.