Questions tagged [domcrawler]

The DomCrawler is a Symfony component for PHP which eases DOM navigation for HTML and XML documents.

The DomCrawler component eases DOM navigation for HTML and XML documents and is part of the the Symfony PHP components.

The filter() function accepts the jQuery Selector Syntax and eases the selection of HTML tags and attributes.

Documentation

179 questions
1
vote
1 answer

Symfony DomCrawler and OpenSSL Connection Reset errors

I am learning Symfony Crawler and want to implement the following scenario: navigate to a certain page fill out a form with data submit the form if you are redirected to example.org/error after submitting, try submitting the form again with…
TeslaX93
  • 117
  • 1
  • 11
1
vote
0 answers

Symfony 2 Dom Crawler: how to get text

I want to fetch the text inside last div. I have tried something below as well $html = $crawler1->filter('span[id="verisysForm:cnicStatusPanel"]')->text(); // returns empty Here is the structure from where i want to get text.
Aqib Javed
  • 935
  • 1
  • 5
  • 15
1
vote
1 answer

Get image URL inside an element from external website - Laravel

As the problem I've mentioned here. I'm going to try alternative way of getting an image url. I want to get the product image url from…
Devin Y
  • 137
  • 2
  • 13
1
vote
1 answer

Don Crawler , get a Javascript attribute of a div onClick

I want to loop the div - my-node-div , and get the LINK that is a javascript onclick property THAT IS IN MY DIV that I am looping . I have this structure -
murilo
  • 41
  • 5
1
vote
1 answer

Get meta tags from url with DOM crawler

I have installed symfony/dom-crawler in my project. I am trying to get some of the meta tags from the URL of some random site to test. $url = 'https://www.lala.rs/fun/this-news'; $crawler = new Crawler($url); $data =…
joopeerr
  • 183
  • 1
  • 1
  • 12
1
vote
1 answer

Can't scrape this site with Goutte Laravel Package. Elements exist in view source

I am building a scraping tool with the Laravel Goutte Package https://github.com/FriendsOfPHP/Goutte I have been able to scrape most websites until I came across this website http://www.bhutanpost.bt/ which I need to scrape. The problem I am…
penjor
  • 21
  • 3
1
vote
0 answers

Symfony DomCrawler not returning expected value

The example is pretty simple. I am trying to experiment with the Symfony's DomCrawler and trying to get the download section of the official PHP page https://www.php.net/ :
Kos-Mos
  • 415
  • 1
  • 5
  • 15
1
vote
0 answers

Symfony 4 crwaler amazon page

Trying to get the default price for the product from these two link ex: link 1 - https://www.amazon.com/Apple-MacBook-15-inch-256GB-Storage/dp/B07RZWRHTS/ link 2 - https://www.amazon.com/gp/product/B013GVDTI4/ using GuzzleHttp and Crawler I can get…
serj
  • 193
  • 1
  • 3
  • 19
1
vote
0 answers

In PHP why can't I scrape this page with DomCrawler to get css selectors text?

This works on other pages including this sites homepage, but I cannot use it on any pages I want which is that website's items they have for sale. I'm trying to get the price, shipping cost, title, description and other details. I'm using …
extrude
  • 11
  • 1
1
vote
0 answers

Symfony DomCrawler get HTML without attributes / styles

I need a way to get a HTML from an email without attributes (class / styles). Currently trying the following: $crawler = new Crawler(); $crawler->addHtmlContent($mail->textHtml); $html = ''; $nodes = $crawler->filter('body > *'); //only stuff…
Syllz
  • 290
  • 6
  • 22
1
vote
0 answers

Symfony DOM Crawler shows that the current node list is empty

Here is part of my code: $heading_text = ''; $heading_nodes = $crawler->filter($heading_selector); if(count($heading_nodes->siblings()) > 0) { $heading_text = str_replace('Something', 'Else', htmlentities($heading_nodes->eq(0)->text())); } I…
Real Noob
  • 1,369
  • 2
  • 15
  • 29
1
vote
1 answer

DomCrawler, selecting class in specific position with first() or last() or eq()

I am a bit confused about selecting one class between it's siblings... Html structure like below.
1
vote
1 answer

Extract data inside an html element attribute (data-react-props) using Symfony DomCrawler

I need to extract a json that is inside a page, more precisely in div inside the tag data-react-props
LegoLiam
  • 97
  • 3
  • 11
1
vote
1 answer

Is there any issue in each loop to break it and not create models?

Is there any problem in following code, I tried so hard but got no answer. I want to create models in each iteration from loop in filtering dom. $node->filter('div.panel-section.font-size-2.font-size-xxs-normal .row')->each(function (Crawler…
Mohammad
  • 69
  • 10
1
vote
1 answer

how to push all the values of each function in one array - PHP DomCrawler

This is my attempt: function getData($data) { $params = []; $products = []; $crawler = new Crawler($data); // $last_updated= $crawler->filter('#content > div.listing__ContentWrapper-sc-1a1m3sv-1.cIZBes.sc-ksYbfQ.kiNQqU > div >…
Haris Khan
  • 335
  • 5
  • 20