Meus documentos/programas/Zend/projetos/lab/yahooSeach/class.yahooImageSearch.inc

00001 <?PHP
00002 
00003    class yahooImageSearch {
00004         
00005         private $_clss;
00006         
00012         public function __construct(yahooSearch $clss) {
00013          $this->_clss = $clss;
00014         }
00015         
00020         private function _resultsXml() {
00021          
00022          $res = explode('<Result>', $this->_clss->getResource());
00023          $search = array();
00024           
00025           for ($i = 0; $i <= (count($res) - 1); $i++) {
00026 
00027            $search[$i]['title'] = $this->_getTagContent($res[$i], 'Title');
00028            $search[$i]['summary'] = $this->_getTagContent($res[$i], 'Summary');
00029            $search[$i]['url'] = $this->_getTagContent($res[$i], 'Url'); 
00030            $search[$i]['clickurl'] = $this->_getTagContent($res[$i], 'ClickUrl');
00031            $search[$i]['refererurl'] = $this->_getTagContent($res[$i], 'RefererUrl');
00032            $search[$i]['filesize'] = $this->_getTagContent($res[$i], 'FileSize');
00033            $search[$i]['fileformat'] = $this->_getTagContent($res[$i], 'FileFormat');
00034            $search[$i]['height'] = $this->_getTagContent($res[$i], 'Height');
00035            $search[$i]['width'] = $this->_getTagContent($res[$i], 'Width');
00036            
00037            $thumb = $this->_getTagContent($res[$i], 'Thumbnail');
00038            $search[$i]['thumbnail']['width'] = $this->_getTagContent($thumb, 'Width');
00039            $search[$i]['thumbnail']['height'] = $this->_getTagContent($thumb, 'Height');
00040            $search[$i]['thumbnail']['url'] = $this->_getTagContent($thumb, 'Url');
00041    
00042           }
00043           
00044           return $search;  
00045           
00046                 
00047         }
00048         
00055         private function _getTagContent($resource, $tag) {
00056          $res = explode('<' . $tag . '>', $resource);
00057          $res1 = explode('</' . $tag . '>', $res[1]);
00058          return $res1[0];
00059         }
00060         
00065         public function results() {
00066          
00067           return $this->_resultsXml();  
00068                         
00069         }
00070         
00071    }
00072    
00073 ?>   
00074    

Generated on Tue Jan 23 16:06:41 2007 for Yahoo! Search for PHP by  doxygen 1.5.1-p1
Hosted by www.Geocities.ws

1