I'm using php version 7.3 and laravel 5.4
I've a controller function fetchUrls
which returns a json response containing urls data
public function fetchUrls($id) {
$urlData = $this->service->fetchUrls($id);
return $this->done(null, [
'url_data' => $urlData
]);
}
Using this controller function in my routes
Route::get('url-data/{id}', 'Url\UrlDataApiController@fetchUrls');
When I hit this api
http://localhost:8000/api/url-data/{1}
The response looks like
{
"urlData": [
{
"id": 1,
"url" "https://example1.com/file"
},
{
"id": 1,
"url": "https://example2.com/file"
}
]
}
Is there any way instead of getting response, can we download the file from url using iteration? or redirect to urls present in the response?