Пример #1
0
<?php

/**
 * Created by PhpStorm.
 * User: rajan
 * Date: 11/07/15
 * Time: 11:42 AM
 */
require_once '/Applications/XAMPP/xamppfiles/htdocs/ireview/php-scrape/vendor/autoload.php';
require_once 'UltraProxy.php';
use Scraper\Proxy\ProxyFactory;
use Scraper\Scrape\Crawler\Types\GeneralCrawler;
$reviewFactory = new GeneralCrawler('https://api.ipify.org?format=json');
$proxies = ProxyFactory::getInstance()->getProxy(new UltraProxy());
print_r($proxies);
foreach ($proxies as $proxy) {
    try {
        $reviewFactory->setProxy($proxy);
        echo $proxy->anonymity . " " . $proxy->getUrl() . " : " . $reviewFactory->getPage()->getContent() . "\n";
    } catch (\Exception $ex) {
        echo $ex->getMessage() . "\n";
    }
}
Пример #2
0
<?php

use Scraper\Proxy\Structure\Proxy;
use Scraper\Scrape\Crawler\Types\GeneralCrawler;
use Scraper\Scrape\Extractor\Types\SingleRowExtractor;
require_once __DIR__ . '/../vendor/autoload.php';
$proxy = new Proxy();
$proxy->pacFile = 'https://proxymesh.com/static/us-ca.pac';
$crawler = new GeneralCrawler('https://github.com/trending', null, true);
$crawler->setProxy($proxy);
$path = __DIR__ . "/Data/git-repo.json";
$extractor = new SingleRowExtractor($crawler, $path);
$data = $extractor->extract();
print_r($data);