Recommend this page to a friend! |
Download |
Info | Example | Demos | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
59% | Total: 332 | All time: 7,129 This week: 488 |
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. |
<?php |
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 (6) |
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 |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
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.