CLI any way to control this with CLI?
ahansson89 opened this issue · 3 comments
We have to create an artisan command to create a new search and it would be possible. The crawl process is already triggered by a command (php artisan crawler:crawl SearchId
), but there is no command yet to create a search first.
The command would be php artisan crawler:search http://example.com
.
It would create a search and launch the crawler:crawl searchId
automatically.
Okay, that would be awesome!
Alternatively is there a post request that I can send that would trigger this?
Post requests need the laravel csrf token to be accepted by the application.
Disable csrf token verification by commenting this line: https://github.com/hedii/php-crawler/blob/master/app/Http/Kernel.php#L31
Then, try to send your request to (i havn't tried it):
POST /searches
With body:
{
"user_id": 1,
"entrypoint": "http://example.com",
"type": email
}
It calls this method: https://github.com/hedii/php-crawler/blob/master/app/Http/Controllers/SearchController.php#L71
As you can see this method calls the crawler so you don't have to issue the command after your post request.
(EDIT: forget it, it will not work, because you need a user to be authenticated)