1. Go to this page and download the library: Download iflow/scrapy library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
iflow / scrapy example snippets
use iflow\Scrapy\implement\Query\Client\Proxy;
use iflow\Scrapy\implement\Query\Queue;
use iflow\Scrapy\implement\Request\Request;
use iflow\Scrapy\implement\Response\Response;
use iflow\Scrapy\Scrapy;
$request = new Request(
'https://baidu.com',
'GET',
cookie: [
[
'Name' => 'Name',
'Value' => 'Value',
'Domain' => '.baidu.com',
'Path' => '/',
'HttpOnly' => true
]
]
);
$queue = new Queue();
for ($i = 0; $i < 0; $i++) {
$queue -> add($request, function (Response $response) {
var_dump($response -> getResponseBodyType() -> getParserContent());
});
}
// 如果不使用代理可以注释
$proxy = new Proxy();
// $proxy -> addProxy('183.195.106.118', 8118);
// 执行请求
(new Scrapy($queue, $proxy, options: [ 'cookies' => true ])) -> request();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.