Basically i want to input multiple site url in textarea and check header response of these input. my code mention below:
use Illuminate\Http\Request;
use Goutte\Client;
//use GuzzleHttp\Client;
use GuzzleHttp\Promise;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
public function Datanewsub(Request $request){
$client = new \GuzzleHttp\Client();
$url= $request->input('url');
$arr = explode("\n", $url);
foreach($arr as $x => $val){
echo $val.'<br>';
$res = $client->request('GET', $val);
echo $res->getStatusCode().'<br>';
}
return view('scraper');
}
}
<textarea>?if($res->getStatusCode() == 200 || $res->getStatusCode() == 404)then save the values in the associative array.