$url = 'http://example.com';
$site = curl_init($url);
curl_setopt($site, CURLOPT_RETURNTRANSFER, true);
$site = curl_exec($site);
if(FALSE){//DO SOMETHING}
I try to use curl scrape page, however I need to detect if url is fail.
-
question, which will be better?
curl or file_get_contents($url)?