I need to use Smarty's fetch
to get some content from another website. But this content is not that important to cause fatal error...
{fetch file="http://sites.com/content"}
The code above will cause PHP fatal error if it fails to get the content, how do I prevent this?
P.S. I don't have access to the source PHP file (it is encoded), so I can only edit template files.
I do not believe it is possible to check for the existence of a remove file in smarty, before fetching it. It might be dangerous to fetch remote files anyway, so it's probably best to avoid that. If the file is on the local server, it's much easier.
But I'm not sure that's going to help you.
Reference: Smarty Forums
Added
Although you don't have access to the main PHP, can you write your own PHP file? Keep it out of the web root, but you cURL and cache the contents with that, then include it by pointing to that file instead.