Login   Register  
PHP Classes
elePHPant
Icontem

File: mmp_test_01.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Rodrigo Contreras K.  >  MMP  >  mmp_test_01.php  >  Download  
File: mmp_test_01.php
Role: Example script
Content type: text/plain
Description: Sample script.
Class: MMP
HTML parser that triggers events for each element
Author: By
Last change:
Date: 2012-04-22 08:48
Size: 581 bytes
 

Contents

Class file image Download
<?php

$classpath
=dirname(__FILE__).'/classes';

include_once 
$classpath.'/html/AbstractMMProcessor.class.php';
include_once 
$classpath.'/html/MMP.class.php';

include_once 
dirname(__FILE__).'/BasicProcessor.class.php';

//our test URL
$url='http://radar.oreilly.com/';

//fetch it
$html=load_html($url);

//get our own custom processor instance:
$processor=new BasicProcessor();

//get the actual parser:
$parser=new MMP($processor);

//do the job:
$parser->parse($html);

function 
load_html($url){
    
$html=file_get_contents($url);
    return 
$html;
}

?>