PHP code example of djomobil / php-scrapyd
1. Go to this page and download the library: Download djomobil/php-scrapyd 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/ */
djomobil / php-scrapyd example snippets
use Djomobil\PhpScrapyd\Services\ScrapydService;
use Djomobil\PhpScrapyd\Helpers\HttpHelper;
$scrapydService = new ScrapydService(
new HttpHelper(),
'http://localhost:6800',
'your_username',
'your_password'
);
$jobId = $scrapydService->job()->scheduleJob([
'project' => 'my_project',
'spider' => 'my_spider'
]);
echo "Job ID: $jobId";
$status = $scrapydService->daemon()->getDaemonStatus();
print_r($status);
bash
composer