Skip to content

Commit

Permalink
~ readme
Browse files Browse the repository at this point in the history
  • Loading branch information
vantoozz committed Feb 20, 2021
1 parent 2d1a112 commit edb16ef
Show file tree
Hide file tree
Showing 11 changed files with 182 additions and 108 deletions.
254 changes: 149 additions & 105 deletions README.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"suggest": {
"ext-json": "*",
"ext-simplexml": "*",
"php-http/guzzle6-adapter": "to use Guzzle as HTTP client",
"guzzlehttp/guzzle": "to use Guzzle as HTTP client",
"guzzlehttp/psr7": "to use Guzzle as HTTP client",
"hanneskod/classtools": "to enable scrapers auto-discovery",
"php-http/message-factory": "to use Psr18HttpClient (deprecated)",
"php-http/message": "to use Psr18HttpClient (deprecated)"
Expand Down
18 changes: 18 additions & 0 deletions examples/02-http_client.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php declare(strict_types=1);

use Vantoozz\ProxyScraper\Exceptions\ScraperException;

use function Vantoozz\ProxyScraper\guzzleHttpClient;
use function Vantoozz\ProxyScraper\proxyScraper;

require_once __DIR__ . '/../vendor/autoload.php';

$httpClient = guzzleHttpClient();

$scraper = proxyScraper($httpClient);

try {
echo $scraper->get()->current()->getIpv4(). "\n";
} catch (ScraperException $e) {
echo $e->getMessage() . "\n";
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public function get(string $uri): string
$scraper = proxyScraper($httpClient);

try {
$scraper->get()->current();
echo $scraper->get()->current()->getIpv4(). "\n";
} catch (ScraperException $e) {
echo $e->getMessage() . "\n";
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

use Vantoozz\ProxyScraper\Scrapers;

use function Vantoozz\ProxyScraper\guzzleHttpClient;

require_once __DIR__ . '/../vendor/autoload.php';

$scraper = new Scrapers\UsProxyScraper(guzzleHttpClient());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

use Vantoozz\ProxyScraper\Scrapers;

use function Vantoozz\ProxyScraper\guzzleHttpClient;

require_once __DIR__ . '/../vendor/autoload.php';

$httpClient = guzzleHttpClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

// Set exception handler
$compositeScraper->handleScraperExceptionWith(function (ScraperException $e) {
echo 'An error occurs: ' . $e->getMessage() . "\n";
echo 'An error occurred: ' . $e->getMessage() . "\n";
});

// Fake scraper throwing an exception
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions examples/07-metrics.php → examples/08-metrics.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
use Vantoozz\ProxyScraper\Proxy;
use Vantoozz\ProxyScraper\Scrapers;

use function Vantoozz\ProxyScraper\guzzleHttpClient;

require_once __DIR__ . '/../vendor/autoload.php';

$scraper = new Scrapers\UsProxyScraper(guzzleHttpClient());
Expand Down
2 changes: 2 additions & 0 deletions support/guzzleHttpClient.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php declare(strict_types=1);

namespace Vantoozz\ProxyScraper;

use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
Expand Down
2 changes: 2 additions & 0 deletions tests/systemTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
use Vantoozz\ProxyScraper\SystemTests\Reports\ExclusivityReport;
use Vantoozz\ProxyScraper\SystemTests\Reports\ReportsPipeline;

use function Vantoozz\ProxyScraper\guzzleHttpClient;

$httpClient = guzzleHttpClient();

$miner = new ProxiesMiner\ScrapersProxiesMiner;
Expand Down

0 comments on commit edb16ef

Please sign in to comment.