PHP Classes

Simple Web Crawler: Retrieve a Web page and extract HTML elements

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 290 All time: 7,505 This week: 488Up
Version License PHP version Categories
web-crawler 1.0Free for non-comm...5.0HTML, PHP 5, Web services, Parsers
Description 

Author

This class can retrieve a Web page and extract HTML elements.

It can take a given URL and retrieve the contents of the specified Web page.

The class can parse the HTML page and extract the URLs of the domain, links and images.

Picture of Karthikeyan
  Performance   Level  
Name: Karthikeyan <contact>
Classes: 2 packages by
Country: India India

Example

<?php
include_once("config.php");
include_once(
"crawler.php");
if(isset(
$_GET["SubmitBox"]))
{
   
$obj = new webCrawler();
   
$obj->siteURL = $_GET["url"];
   
$returnData = $obj->parser();
    echo
"<pre>";
   
print_r($returnData);
    echo
"</pre>";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>Web Crawler</title>
    <style>
    .textbox
    {
        border: medium none;
        font-family: Arial,Sans-Serif;
        font-size: 16px;
        height:28px;
        line-height: 24px;
        width: 578px;
        border: 1px solid #ACBABD;
        padding:5px;
    }
    .submitbox
    {
        height:40px;
        width:80px;
        text-align:center;
    }
    </style>
</head>
<body>
    <div style="padding:10px;">
        <div>
            <form name="crawlsearch" method="get" action="index.php">
            <table>
            <tr>
                <td align="center" colspan="2"><b>Web Crawl</b></td>
            </tr>
            <tr>
                <td>
                    <input class="textbox" type="text" placeholder="Enter URL" name="url">
                </td>
                <td>
                    <input class="submitbox" type="submit" name= "SubmitBox" value="Crawl">
                </td>
            </tr>
            </table>
            </form>
        </div>
    </div>
</body>
<html>


  Files folder image Files (3)  
File Role Description
Accessible without login Plain text file config.php Conf. Configuration File
Plain text file crawler.php Class Crawler Class File
Accessible without login Plain text file index.php Example Sample File

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 Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:290
This week:0
All time:7,505
This week:488Up