0

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? }

homa
  • 1
  • This is not a question that can be clearly answered. it asks for an opinion. – arkascha Jan 24 '15 at 16:18
  • Dose my server must download file to underestand is it valid? do both of these method do it? – homa Jan 24 '15 at 16:21
  • Here is a related question that may help you to decide if you want to use one of the above or perhaps using both and wrap file operation in try/catch. Link: http://stackoverflow.com/a/24754161/2777098 – display name Jan 24 '15 at 16:21

0 Answers0