|
|
- <?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'
- ];
-
- $handler = new RssHandler();
- $response = $handler->get($url);
-
- // if it is a 200
- if ($response->ok()) {
- $handler->run($response, $actions);
-
- // 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();
- }
- }
|