PHP Classes

Extract div data or tags text from Web pages: I need to extract the values that are in divs of the same class

Recommend this page to a friend!
  All requests RSS feed  >  Extract div data or tags text from We...  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

Extract div data or tags text from Web pages

Edit

Picture of Guilherme Soratto by Guilherme Soratto - 10 years ago (2015-01-02)

I need to extract the values that are in divs of the same class

This request is clear and relevant.
This request is not clear or is not relevant.

+1

I need to extract the values that are in divs of the same class.

I have only the name of the div class, for example, a list of div <div class = "event-id" /> and would like to get the values of all div with the "event-id" class, values of a specific tag inside the div or directly in it.

Ask clarification

2 Recommendations

Very simple page details: Parse and extract Web page information details

This class can parse and extract Web page information details.

It can retrieve a Web page from a given URL and parse it to extract details like:

- Page title
- Page head and body
- Meta tags
- Character set
- Links expanded to full path
- Images
- Page headers from H1 through H6
- Internal and external links checking if they are broken
- Page elements by class or id value
This recommendation solves the problem.
This recommendation does not solve the problem.

0

Picture of zinsou A.A.E.Moïse by zinsou A.A.E.Moïse package author package author Reputation 6835 - 7 years ago (2017-12-22) Comment

one may try this...


HTMLPP: Parse HTML code and manage the DOM structure

HTMLPP is a PHP4 library for HTML code parsing. It allows you to parse a HTML code string, build the relative DOM structure and work on it with methods similar to Javascript.

Features:


HTML parsing:
- Simple tags
- Tags without closures
- Autoclosing tags
- Doctype, text and comment parsing
- Modern browser parsing behaviour (Add head,body and html tags if they're not present, Wrap table content inside the tbody if it's not present)

Dom traversing:
- Access to the parent node using the parentNode property
- Access to child nodes using the childNodes array property
- Access to sibling nodes using nextSibling and previousSibling properties
- Access to the owner document with ownerDocument property
- Document shortcuts to body, head and doctype

Dom manipulation:
- Append nodes with appendChild, append and other methods
- Remove nodes with removeChild and remove methods
- Replace nodes with replaceChild and replace methods

Attributes and style manipulation:
- Add, remove, set and get methods for attributes
- Add, remove, set and get methods for style properties

Node searching functions on every element:
- getElementById
- getElementsByTagName
- getElementsByClassName
- getElementsBySelector (Full featured support for Css3 selectors, Support for other non-standard selectors)
- Node iterator class for personalized filter functions

Dom collections with JQuery like methods:
- Add, remove and filter elements in the collection
- Change the current collection by searching in its elements siblings, child nodes or parent nodes
- Manipulate elements in the collection



Changelog:

1.0
- first release
1.0.1
- Fixed some bugs in elements parsing regexp
- Fixed a bug in doctype parsing
- Fixed some problems in the parser class
- Fixed a bug in HTMLFilterIterator::find() function when pass HTML_SEARCH_DESCENDANT as iteration type
1.0.2
- Fixed error on selector parsing
- Now every element is closed at the end of its parent code if no closing tag is found
- Better support for textarea tag
- Fixed bug on attributes parsing (thanks Mike)
1.0.3
- Fixed bug in getAttribute() method
- Fixed bug in getStyle() method
- Fixed bug on attributes parsing
This recommendation solves the problem.
This recommendation does not solve the problem.

0

Picture of Manuel Lemos by Manuel Lemos Reputation 26695 - 10 years ago (2015-01-09) Comment

This class can be used for extracting HTML nodes of elements that match a given CSS class using the getElementsByClassName function in PHP, just like you can use it in JavaScript.


Recommend package
: 
: