Hi there I want to check error-handling for an external URL (film/images) to know it is valid or not.(in my server)
I Found 2 methods:
First: try-catch method
try {
$path = savePic(...);
}
catch (MalformedURLException e) {
// exception handler code here
// ...
}
Or something like this:
if($file = fopen ($url, "rb")
{
$path = savePic($file);
}
else
{
// URL is invalid
}
Which one is better and faster for a large file?
Is there a better method to do it? }