php - How to Continue Scrapping to next array(i) if one return "Failed to Open Steam" -
i using curl method check http response before scrapping.
foreach($urls $url){ if($response($url)==200){ $html= new \htmldom($url);}}
but as(the server response 404), loop stops, want continue(move next one) 1 of pages returns fails.
i using laravel yanqi htmldom parser
i think have user try{}catch{}
blocks continue looping process. below example this.
foreach($urls $url) { try{ if($response($url)==200) { $html= new \htmldom($url); } } catch(\exception $e) { // can catch exception } }
i think you.
Comments
Post a Comment