Closed andrii-trush closed 4 years ago
Hello. I'm trying to get url returns 404 error.
$goutteClient = new Client(); $response = $goutteClient->setHeader('User-Agent', $userAgent)->setClient($guzzleClient)->request('GET', 'https://example.com');
$response is instance of Symfony\Component\DomCrawler\Crawler
$response
Symfony\Component\DomCrawler\Crawler
So, how can I get status for checking it is 404?
$goutteClient->getResponse() will give you the Response object of the last request being done (and you should rename your $response variable, which is not the response.
$goutteClient->getResponse()
Hello. I'm trying to get url returns 404 error.
$response
is instance ofSymfony\Component\DomCrawler\Crawler
So, how can I get status for checking it is 404?