1<?php 2 3class MyFetcherMemory extends Fetcher { 4 var $base_path; 5 var $content; 6 7 function MyFetcherMemory($content, $base_path) { 8 $this->content = $content; 9 $this->base_path = $base_path; 10 } 11 12 function get_data($url) { 13 if (!$url) { 14 return new FetchedDataURL($this->content, array(), ""); 15 } else { 16 // remove the "file:///" protocol 17 if (substr($url,0,8)=='file:///') { 18 $url=substr($url,8); 19 }; 20 21 $url = urldecode($url); 22 return new FetchedDataURL(@file_get_contents($url), array(), ""); 23 } 24 } 25 26 function get_base_url() { 27 return 'file:///'.$this->base_path.'/dummy.html'; 28 } 29} 30 31?>