Login   Register  
PHP Classes
elePHPant
Icontem

File: ExampleCrawlImage.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Md. Shaiful islam  >  Crawler  >  ExampleCrawlImage.php  >  Download  
File: ExampleCrawlImage.php
Role: Example script
Content type: text/plain
Description: Crawl Image form http://www.phpclasses.org/ site
Class: Crawler
Extract links and images from remote Web pages
Author: By
Last change:
Date: 2008-03-09 19:45
Size: 958 bytes
 

Contents

Class file image Download
<?php
include("Crawler.php");
$mycrawler=new Crawler();
$url='http://www.phpclasses.org/';
$image=$mycrawler->crawlImage($url);

//print the result

echo "<table width=\"100%\" border=\"1\">
  <tr>
    <td width=\"30%\"><div align=\"center\"><b>Image</b></div></td>
    <td width=\"30%\"><div align=\"center\"><b>Link</b></div></td>
    <td width=\"40%\"><div align=\"center\"><b>Image Link</b> </div></td>
  </tr>"
;
for(
$i=0;$i<sizeof($image['link']);$i++)
{
echo 
"<tr>
    <td><div align=\"center\"><img src=\""
.$image['src'][$i]."\"/></div></td>";
if((
$image['link'][$i])==null)
{
    echo 
"<td width=\"30%\"><div align=\"center\">No Link</div></td>
    <td width=\"40%\"><div align=\"center\">No Link</div></td>
  </tr>"
;
}
else 
{
    echo 
"<td><div align=\"center\">".$image['link'][$i]."</div></td>
    <td><div align=\"center\"><a href=\""
.$image['link'][$i]."\">Go to link.</a></div></td>
    </tr>"
;        
}
        
}  
echo 
"</table>";
?>