| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 10 /** 11 * class lmbUriContentReader. 12 * 13 * @package web_spider 14 * @version $Id: lmbUriContentReader.class.php 5945 2007-06-06 08:31:43Z pachanga $ 15 */ 16 class lmbUriContentReader 17 { 18 protected $content; 19 protected $http_response_header; 20 protected $resource; 21 22 function __destruct() 23 { 24 $this->releaseResource(); 25 } 26 27 function releaseResource() 28 { 29 if($this->resource) 30 fclose($this->resource); 31 32 $this->resource = null; 33 } 34 35 function reset() 36 { 37 $this->http_response_header = array(); 38 $this->content = ''; 39 $this->uri = null; 40 $this->releaseResource(); 41 } 42 43 function open($uri) 44 { 45 $this->reset(); 46 47 $this->uri = $uri; 48 49 if($this->resource = @fopen($uri->toString(), 'r')) 50 $this->http_response_header = stream_get_meta_data($this->resource); 51 } 52 53 function getUri() 54 { 55 return $this->uri; 56 } 57 58 function getContent() 59 { 60 if($this->content) 61 return $this->content; 62 63 while($line = fgets($this->resource, 2000)) 64 $this->content .= $line; 65 66 return $this->content; 67 } 68 69 function getHttpResponseHeader() 70 { 71 return $this->http_response_header; 72 } 73 74 function getContentType() 75 { 76 if(!isset($this->http_response_header['wrapper_data'])) 77 return; 78 79 foreach($this->http_response_header['wrapper_data'] as $header) 80 if(preg_match('~^Content-Type:\s*([^;\s]+)~', $header, $matches)) 81 return $matches[1]; 82 83 return false; 84 } 85 86 } 87 88 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sat Aug 30 04:38:32 2008 | Cross-referenced by PHPXref 0.7 |