Ejemplo n.º 1
0
<?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 = '*****@*****.**';
    $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());
}
Ejemplo n.º 2
0
<?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 = '*****@*****.**';
    $pass = '******';
    $gwtCrawlErrors = new GwtCrawlErrors();
    if ($gwtCrawlErrors->login($mail, $pass)) {
        // iterate over all connected domains
        $sites = $gwtCrawlErrors->getSites();
        foreach ($sites as $domain) {
            // use an absolute path without trailing slash as
            // a second parameter, to write data to file system.
            $gwtCrawlErrors->getCsv($domain, __DIR__);
        }
    }
} catch (Exception $e) {
    die($e->getMessage());
}