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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -