Recommend this page to a friend! |
![]() |
Info | Example | Demos | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
![]() ![]() ![]() | Total: 332 | All time: 7,129 This week: 51![]() |
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.
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() |
Class | Class source | ||
![]() |
Class | Class source | ||
![]() |
Example | Example script | ||
![]() |
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. |
![]() |
![]() | 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.