Questions tagged [simple-html-dom]

Simple HTML DOM is an open source HTML DOM parser written for PHP5+ which lets users easily manipulate HTML.

PHP Simple HTML DOM Parser is an open source project created by S.C. Chen, based on the HTML Parser for PHP 4. It's a PHP 5+ HTML DOM parser class which helps with HTML elements manipulation.

The parser is not limited to valid HTML and can also parse HTML code that did not pass W3C validation. Document objects can be found using selectors, similar to what is possible with .

Elements can be targeted with simple selectors. DOM elements can also be added, deleted or altered. Simple HTML DOM is appropriate for simple tasks but lacks support for many CSS selectors and leaks memory (see manual).

More information on the SourceForge project's page.

1672 questions
8
votes
3 answers

Simple HTML Dom - Fatal error when using load_file

I'm trying to parse an HTML file that has terrible (believe me, it is) HTML structure and because of this and my lack of knowledge, I couldn't write my own parser. Later I tried using Simple HTML Dom parser, because a lot of people (on SO as well)…
Martin Fejes
  • 677
  • 12
  • 20
7
votes
3 answers

How to convert simple_html_dom object back to string?

I have used PHP Simple HTML DOM Parser to first convert an HTML string to DOM object by str_get_html() method of simple_html_dom.php $summary = str_get_html($html_string); Then I extracted an object from the $summary by foreach…
Solace
  • 8,612
  • 22
  • 95
  • 183
7
votes
1 answer

How Can I Run a Local PHP Simple HTML DOM Parser with a Proxy?

I have a PHP Simple HTML DOM Parser locally in MAMP that pulls information and works well with the Japan version of a website, since I'm located in Japan. However, I would like to pull information from the UK version of the site. What is the…
user4906320
7
votes
2 answers

Remove rowspan on tables in PHP

There is this table i want to load into a multi-dimensional array. The problem is that since the table has rowspan values each line may have different cell counts. So i have to remove rowspan and add null values instead of these cells. This is the…
Mustafa
  • 825
  • 3
  • 14
  • 37
6
votes
3 answers

Trouble getting the name of a product from a webpage

I've written a script in php to scrape the title of a product located at the top right corner in a webpage. The title is visible as Gucci. when I execute my below script, it gives me an error Notice: Trying to get property 'plaintext' of non-object…
SIM
  • 21,997
  • 5
  • 37
  • 109
6
votes
2 answers

How do I find this div ? (PHP Simple HTML DOM Parser)

This is my code: find('div#ires', 0)->innertext; echo $title; ?> It outputs all result of the Google Search…
user9089885
6
votes
1 answer

How Can I Log Into a Web Forms Website Before Parsing with Simple HTML Dom Parser?

Here is what I am trying to accomplish: I need to scrape product data from this website, but the pricing is different when you are logged in. Thus, I need to submit this login form (via php), then use Simple HTML DOM Parser to scrape the product…
Derek Foulk
  • 1,892
  • 1
  • 19
  • 37
6
votes
1 answer

How to use array_push with associative array and index key?

I am a bit 'rusty with php as it happens that sometimes I use it for weeks and sometimes it happens that you do not use for months. Either way I'm trying to pass values of another array are "array", on another array in an orderly manner ... What I…
Bender
  • 523
  • 6
  • 21
6
votes
1 answer

Get html between comments block Simple HTM DOM

How can I take a block of DOM by identify its 'comment' tag, like

Hello world etc

something
I'm using Simple PHP DOM parser, but the doc is incomplete,…
Elton Jamie
  • 586
  • 6
  • 17
6
votes
2 answers

Combining CURL and simple html dom

I have been working with CURL to scrape websites for a while and also Simple HTML DOM. I experienced that CURL is much better for scraping websites. However I really like the simplicity of Simple HTML DOM. So I figured why not combine the two, I…
Youss
  • 4,196
  • 12
  • 55
  • 109
6
votes
4 answers

getting element content with simpe-html-dom

I'm using simpile_html_dom for getting html pages elements. I have some div elements like this. All i want is to get "Fine Thanks" sentence in each div (that is not inside any sub-element). How can i do it?

AshKan
  • 779
  • 2
  • 8
  • 22

6
votes
3 answers

Find div with class using PHP Simple HTML DOM Parser

I am just starting with the mentioned Parser and somehow running on problems directly with the beginning. Referring to this tutorial: http://net.tutsplus.com/tutorials/php/html-parsing-and-screen-scraping-with-the-simple-html-dom-library/ I want now…
Owl
  • 689
  • 5
  • 15
  • 29
6
votes
3 answers

How to check if a SimpleHTMLDom element does not exist

SimpleHtmldom can be used to extract the contents of the first element with class description. $html = str_get_html($html); $html->find('.description', 0) However if this class does not exist, PHP will throw an error Trying to get property of…
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
5
votes
1 answer

Get all HTML list element using Simple HTML Dom

Currently I am working on a project which requires me to parse some data from an alternative website, and I'm having some issues (note I am very new to PHP coding.) Here's the code I am using below + the content it returns. $dl =…
Herbo
  • 155
  • 6
5
votes
2 answers

Php webscraping using simple html dom not working when output is out of order html tags

I want to scrap some information of a webpage .It uses a table layout structure. I want to extract the third table inside the nested table layout which contains a series of nested tables .Each publishing a result .But the code is not working…
codefreaK
  • 3,584
  • 5
  • 34
  • 65