예제 #1
0
<?php

include 'website_parser.php';
//Instance of WebsiteParser
$parser = new WebsiteParser('http://morshed-alam.com/');
//Get all hyper links
$links = $parser->getHrefLinks();
//Get all image sources
$images = $parser->getImageSources();
echo "<pre>";
print_r($links);
echo "<br />";
print_r($images);
echo "</pre>";
/**
* ==========================================
* Sample Output
* ==========================================
Array
(
   [0] => Array
       (
           [0] => https://github.com/joliss/jquery-ui-rails
           [1] => jquery-ui-rails
       )

   [1] => Array
       (
           [0] => http://gembundler.com/rails23.html
           [1] => Click here
       )
예제 #2
0
<?php

include 'website_parser.php';
$links = $images = array();
$default_check = 'checked';
$href = isset($_GET['href']) ? 1 : 0;
$image = isset($_GET['image']) ? 1 : 0;
$meta = isset($_GET['meta']) ? 1 : 0;
$target_url = isset($_GET['target_url']) ? $_GET['target_url'] : '';
$link_type = isset($_GET['link_type']) ? $_GET['link_type'] : 'all';
$parser = new WebsiteParser($target_url, $link_type);
if (isset($_GET['target_url'])) {
    $default_check = '';
    $title = $parser->getTitle(true);
    if ($href) {
        $links = $parser->getHrefLinks(false);
    }
    if ($image) {
        $images = $parser->getImageSources();
    }
    if ($meta) {
        $meta_tags = $parser->getMetaTags();
    }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Extract Urls</title>