$file = "https://www.some-api.com/?a=get_info";
$doge = (object) json_decode(file_get_contents($file));
if ($doge == false){
echo "failure";
}
else
{
[my code]
};
Every once and a while my script will fail, not all the time, simply intermittently. PHP error indicates that it's failing at the point of getting the file contents.
My attempt here with this else statement (that has not worked), was to display something different when the contents failed to be received. Is there a simple way for me to add a failsafe, so that either the script is reloaded or a different process is run if the api fails to respond properly?