done server
This commit is contained in:
parent
a4109d709e
commit
e49b986c8a
1 changed files with 8 additions and 2 deletions
|
@ -20,7 +20,7 @@ public function index()
|
||||||
public function crawlWebsite(Request $request)
|
public function crawlWebsite(Request $request)
|
||||||
{
|
{
|
||||||
$url = $request->query('url');
|
$url = $request->query('url');
|
||||||
$depth = $request->query('depth', 1);
|
$depth = $request->query('depth', 0);
|
||||||
$refresh = $request->query('refresh', false);
|
$refresh = $request->query('refresh', false);
|
||||||
|
|
||||||
// Check if the URL is already in the database
|
// Check if the URL is already in the database
|
||||||
|
@ -122,7 +122,13 @@ protected function getLinksFromPage($crawlerContent)
|
||||||
|
|
||||||
protected function scan($url)
|
protected function scan($url)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
$result = $this->webClient->request('GET', $url);
|
$result = $this->webClient->request('GET', $url);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => 'Failed to retrieve the URL',
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue