I am using file_get_contents() on an image url which redirects to another image url. This results in a PHP error file_get_contents(www.modernpads.info/p/2161621.jpg) [function.file-get-contents]: failed to open stream: No such file or directory.
- Is there a way to
getthat image file even though the initial url redirects to another url? - If the above cannot be done, how can I not return the PHP error and simply ignore it?
The redirect isn’t your problem; it looks like the URL is missing an
httpscheme. Without the scheme, PHP thinks it’s a file.