sachinsinghshekhawat / simple-html-parser-php
Simple HTML parser for PHP
Installs: 155
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Language:HTML
Requires
- php: >=5.6.32
This package is not auto-updated.
Last update: 2024-04-11 18:43:04 UTC
README
Version 1.1.5
Supports PHP >=5.6.32 Adaptation for Composer and PSR-0 of: Its a HTML dom parser for PHP, you can either process a URL or HTML string, given function will return a DOM object, which can be used for further processing.
To get DOM object from a URL, use function file_get_html():
$dom = HTMLParser::file_get_html("https://google.com");
To get DOM object from a string, use function str_get_html():
$dom = HTMLParser::str_get_html("<html><head></head><body></body></html>");
Install
composer require sachinsinghshekhawat/simple-html-parser-php 1.1.5
Run "composer require sachinsinghshekhawat/simple-html-parser-php 1.1.5" in your project and ready to go. You can replace last argument with any of the version available.
Usage
<?php
use sachinsinghshekhawat\SimpleHTMLDomParserPHP\HTMLParser;
require 'vendor/autoload.php'; //change path of your vendor autload file
$dom = HTMLParser::file_get_html("https://google.com");
foreach($dom->find('img') as $element)
echo $element->src . '<br>';
For more documentations: http://simplehtmldom.sourceforge.net/