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
0 answers

The current node list is empty php scraping

I am having an issue getting an image from a page. Some pages have it some don't. On the ones that don't i get the current node list is empty error. I am doing !empty($crawler->filter('.listing-logo > img')->attr('src')) but it still returns the…
TheDizzle
  • 1,534
  • 5
  • 33
  • 76
1
vote
1 answer

symfony crawler access nested div

I'm desperately trying to access content in a nested div :
frian
  • 46
  • 1
  • 5
1
vote
1 answer

Test uri with included space character yields "current node list is empty"

Attempts to test a uri with an included space character fail. The uri is /contact/latestReport/Most recent. Each of the trials below results in The current node list is empty Trials include: $crawler = $client->request('GET',…
geoB
  • 4,578
  • 5
  • 37
  • 70
1
vote
1 answer

How to get all TEXT outside elements in a HTML document

I'm using Symfony DomCrawler to get all text in a document. $this->crawler->filter('p')->each(function (Crawler $node, $i) { // process text }); I'm trying to gather all text within the that are outside of elements. This is…
Richard Fernandez
  • 558
  • 1
  • 6
  • 18
1
vote
0 answers

Goutte returning wrong url for multiple url scraping

I am using https://github.com/FriendsOfPHP/Goutte. I keep getting the wrong url on clicking the pagination link in while loop. The selectLink on the object returns the right url for the first while loop. Looks like the second loop returns the wrong…
Sankalp Tambe
  • 400
  • 4
  • 15
1
vote
1 answer

Symfony DomCrawler take all div element in html file

I want to take all element in html file. $crawler = new Crawler($html); for($i = 0; $i < $crawler->filter("div")->count(); $i++){ $div = $crawler->filter("div")->html(); Doing this I always take the first div element: How can I take all div…
Isky
  • 1,328
  • 2
  • 14
  • 33
1
vote
1 answer

Form tests: How to submit a collection to an existing form?

I use two ways to test my forms: By using $form = …->form(); Then setting the values of the $form array (more precisely this is a \Symfony\Component\DomCrawler\Form object): Full example from the documentation: $form =…
A.L
  • 10,259
  • 10
  • 67
  • 98
1
vote
1 answer

CakePHP 3 Integration tests with domcrawler

I've been using Laravel and Symfony for a while and I'm very happy with the testing with DomCrawler. Now at work I'm using CakePHP 3, and I'm not comfortable with the integration testing system, it's like…
SkarXa
  • 1,184
  • 1
  • 12
  • 24
1
vote
0 answers

PHP crawler Detect that a link causes a file download

I'm developing a php crawler and i can get all of link's href in page. i don't want to save url of file download link in my database, such as…
Manian Rezaee
  • 1,012
  • 12
  • 26
1
vote
1 answer

PHP DomCrawler ,Get child node based on a specific parent

Get child node based on a specific parent function(Crawler $node,){ $node->filter('this>ul'); } How can I get a $node children,that does not contain a grandson like the CSS selector #parent>child ?
韩川川
  • 11
  • 4
1
vote
2 answers

domcrawler loop and if statement to check if class exists

Hi I'm running into a little problem with DomCrawler. I'm scraping a page and it has a div with a class of .icon3d. I want to go through the page and for every div with that class I will add an "3D" item to an array, and every div without it I will…
icetimux
  • 215
  • 1
  • 4
  • 11
1
vote
2 answers

Symfony DomCrawler. Filter condition

I have this script in Symfony 2: use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\DomCrawler\Crawler; class MyController extends Controller { .... foreach($crawler->filter('[type="text/css"]') as $content){ /* make…
Avara
  • 1,753
  • 2
  • 17
  • 24
1
vote
1 answer

How to make crawling and extracting data in each pager links?

I want to extract all the attributes name="" of a website, example html I have the following code:
laur
  • 500
  • 1
  • 9
  • 23
1
vote
2 answers

Guzzle response can't be used with Domcrawler()

I'm trying to scrape some content from a site. I eventually discovered that it requires cookies, so I solved that with the guzzle cookie plugin. It's strange because I cannot get the content from doing a var_dump, but it will show the page if I do…
GAV
  • 1,205
  • 2
  • 18
  • 38
1
vote
1 answer

Symfony 2 test xml with Symfony\Component\DomCrawler\Crawler

I've got an url that return an xml but I have some problem to extract "link" element. 123 my title
Dennais
  • 476
  • 5
  • 14