domcrawler

I get no data when download images

笑着哭i 提交于 2021-02-11 14:53:27
问题 so iam trying to download images by this code i successfully download the images but they without any data and corrupted like the images have 0 bytes function get_chapter_images(){ include('simple_html_dom.php'); $url = 'http://localhost/wordpress/manga/manga-name-ain/chapter-4/'; $html = file_get_html($url); $images_url = array(); foreach($html->find('.page-break img') as $e){ $image_links = $e->src; array_push( $images_url, $image_links); } return $images_url; } $images_links = get_chapter

Web Scrape Symfony2 - Impossible Challenge - Crawler Parsing

随声附和 提交于 2020-03-21 07:14:40
问题 (Edit: I've still found no way of solving this problem. The $crawler object seems ridiculous to work with, I just want to parse it for a specific <td> text, how hard is that? I cannot serialize() the entire crawler object either and make the entire source code for the web page into a string, or else I could just parse that string the hard way. Please help. I feel I've described the problem well, below.) Below I'm using Symfony, Goutte, and DomCrawler to scrape a web page. I've been trying to

How to parse html table to array with symfony dom crawler

霸气de小男生 提交于 2020-01-01 10:08:53
问题 I have html table and I want to make array from that table $html = '<table> <tr> <td>satu</td> <td>dua</td> </tr> <tr> <td>tiga</td> <td>empat</td> </tr> </table> My array must look like this array( array( "satu", "dua", ), array( "tiga", "empat", ) ) I have tried the below code but could not get the array as I need $crawler = new Crawler(); $crawler->addHTMLContent($html); $row = array(); $tr_elements = $crawler->filterXPath('//table/tr'); foreach ($tr_elements as $tr) { // ??????? } 回答1:

How to select a link using its id or its label with the symfony dom crawler?

自作多情 提交于 2019-12-11 15:51:42
问题 Is it possible to select a link using its id or its class with the symfony crawler? I tried: $crawler()->selectLink('#return-button')->link(); $crawler()->selectLink('.btn.return')->link(); But I have the error: InvalidArgumentException: The current node list is empty. Does the selector only works using the content of the a tag? 回答1: Yes, it only works with the link text or alt attribute if your link is an image. The filter() method uses the CssSelector component to transform a selector into

Symfony 2 Dom Crawler: how to get only text() in Element

六月ゝ 毕业季﹏ 提交于 2019-12-10 12:58:40
问题 Using Dom Crawler to get only text (without tag). $html = EOT<<< <div class="coucu"> Get Description <span>Coucu</span> </div> EOT; $crawler = new Crawler($html); $crawler = $crawler->filter('.coucu')->first()->text(); output: Get Description Coucu I want to output (only): Get Description UPDATE: I found a solution for this: (but it's really bad solution) ... $html = $crawler->filter('.coucu')->html(); // use strip_tags_content in https://php.net/strip_tags $html = strip_tags_content($html,

DOMCrawler not dumping data properly for parsing

坚强是说给别人听的谎言 提交于 2019-12-08 08:21:43
问题 I'm using Symfony, Goutte, and DOMCrawler to scrape a page. Unfortunately, this page has many old fashioned tables of data, and no IDs or classes or identifying factors. So I'm trying to find a table by parsing through the source code I get back from the request, but I can't seem to access any information I think when I try to filter it, it only filters the first node, and that's not where my desired data is, so it returns nothing. so I have a $crawler object. And I've tried to loop through

Difference between Crawling and getiting links with Html Agility pack,

ぃ、小莉子 提交于 2019-12-02 21:33:26
问题 i am getting links of a website using Html Agility pack with console application c#, by giving the divs that i want and get the links from those divs, my question is the thing i am doing is crawling or parsing, if not then what is crawling 来源: https://stackoverflow.com/questions/36324098/difference-between-crawling-and-getiting-links-with-html-agility-pack