Recommend this page to a friend! |
Download .zip |
Info | Example | Demos | View files (6) | Download .zip | Reputation | Support forum (2) | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2022-10-21 (28 days ago) | 59% | Total: 318 This week: 5 | All time: 7,208 This week: 170 |
Version | License | PHP version | Categories | |||
scrap-html-elements 1.0.2 | The PHP License | 5 | HTML, PHP 5, Parsers |
Collaborate with this project | Author | |
HtmlScrapingRequest - github.com Description This package can retrieve HTML pages and scrape tag elements. |
How to use
1. Require class: require_once 'class.HttpRequest.php';
2. Using: $http = new Httprequest();
3. Using: $http->setServer($_POST['domain']);
`if (isset($_POST['domain'])) { //it is a URL of page that you want to scrap`
$http->setServer($_POST['domain']);
`}`
`$html = $http->send();`
`if (isset($html->error)) {`
echo json_encode($html); exit();
`}`
`$result = $html->contents;`
`if (isset($_POST['tag-element'])) { // it is a selector (img.thumbnail)`
$response = array();
$checkData = $result->find($_POST['tag-element']);
if (count($checkData)) {
foreach ($checkData as $key => $check) {
array_push($response, $check->outertext());
}
}
echo json_encode($response); exit(); // Get your result -> by JSON or any format response
`}`
I highly appreciate any of your donations.
Files |
File | Role | Description | ||
---|---|---|---|---|
img (1 file) | ||||
js (1 file) | ||||
class.HttpRequest.php | Class | Class source | ||
class.SimpleHtmlDom.php | Class | Class source | ||
index.php | Example | Example script | ||
README.md | Doc. | Documentation |
scrap-html-elements-2022-10-21.zip 69KB | |
scrap-html-elements-2022-10-21.tar.gz 70KB | |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Ratings | User Comments (1) | ||||||||||||||||||||||||||||||||||
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.