I'm getting 403 errors when using file_get_contents()
,
I want to handle this error like this,
if(required_function(file_get_contents($url))){ //detects there is a 403
error
// do some special set of tasks
}else{
//run normally
}
I tried to read the error since the url shows the error when I pasted in the browser , but is not getting in to file_get_contents()
so I failed. I don't think changing user agent will work because systems may still be able to detect this is a script ,so I realized if I could detect the 403 error, the script will not crash.
any ideas ?
please help , I'm new to programming. thanks a lot.