i trying below code but result is blank.
someone can help to how i scrape image.
$client = new Client(HttpClient::create(['timeout' => 60]));
$url = 'https://www.gumtree.com.au/s-wheels-tyres-rims/tyres/k0c18476';
$selector = 'div.user-ad-collection-new-design__wrapper--row > a';
$req = $client->request('GET', $url);
$req->filter($selector)->each(function (Crawler $node) {
$node->html();
$description = $node->filter('div p.user-ad-row-new-design__description-text')->text();
$price = $node->filter('div span.user-ad-price-new-design__price')->text();
$location = $node->filter('div.user-ad-row-new-design__location')->text();
$title = $node->filter('p span.user-ad-row-new-design__title-span')->text();
$time = $node->filter('p.user-ad-row-new-design__age')->text();
$link = 'https://www.gumtree.com.au'.$node->attr('href');
$node->filter('img')->each(function ($node) {
echo $node->attr('src').'<br>';
}
My Answer:
> 60]));
$crawler = $client->request('GET', 'https://example.com');
$imageUrl = $crawler->filter('img')->attr('src');
echo $imageUrl;
Rate this post
4 of 5 based on 4650 votesComments