I was trying to use the script given here php get all the images from url which width and height >=200 more quicker
I downloaded and used the simple_html_dom.php given here http://sourceforge.net/projects/simplehtmldom/
It works for most urls, but when I use something like http://www1.macys.com/shop/mens-clothing/mens-athletic-wear?id=59165&edge=hybrid&cm_sp=us_men%27s-men%27s-apparel-activewear-_-t-shirts#!fn=APPAREL_TYPE%3DT-Shirts%26sortBy%3DORIGINAL%26productsPerPage%3D40&!qvp=iqvp
The script simply crashes. Can someone help?
EDIT: I put error reporting and it gives this.
Fatal error: Call to a member function find() on a non-object in /var/www/smartbiz/smartbiz/test2.php on line 16
line 16: if ($html->find ( 'img' )) {
EDIT2: Not sure if this is relevant PHP simple html dom: apache crashes , PHP simple html dom: apache crashes
You can wrap your code in a try-catch statement.
<?
try{
// Your image checking code..
}catch( Exception $e ){
echo "Image not found: $e";
}
?>
It sounds like the error is that the HTML is not loading. We'll need more of your code otherwise I can just give you basic debugging advise.
Try putting the HTML in another way.
$html = str_get_html( file_get_contents( $YOUR_URL ) );
I hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.