You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

69 lines
1.5 KiB

<?php
namespace App\Commands;
use Illuminate\Console\Scheduling\Schedule;
use LaravelZero\Framework\Commands\Command;
use Illuminate\Support\Facades\Http;
use SimpleXMLElement;
class CrawlerRunCommand extends Command
{
/**
* The signature of the command.
*
* @var string
*/
protected $signature = 'crawler:run';
/**
* The description of the command.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$sources = [
'https://steadyhq.com/rss/krautreporter?auth=f7da00aa-fd3f-4411-a16f-138a1ce88dcc',
'https://steadyhq.com/rss/insertmoin?auth=d37bffc9-9a84-4eed-95f6-3b6cb77c2406'
];
$handlerClass = $source->response_handler_class;
$handler = new $handlerClass($source);
$response = $handler->getResponse();
// if it is a 200
if ($response->ok()) {
$handler->run();
// if there is an error on the source
} else if ($response->serverError()) {
}
}
private function get($url, $handler)
{
}
/**
* Define the command's schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*
*/
public function schedule(Schedule $schedule): void
{
$schedule->command(static::class)->everyMinute();
}
}