Jump to content

file_get_contents() what to do if url not respond?


Imaulle

Recommended Posts

Hello, is this ok to do? or should I add in some type of fail safe in case for some reason the server is down etc? If so, how?

 

        public function check_update()
{
	$query  = $this->db->where('setting_name', 'version')->get('settings')->row();
	$latest = file_get_contents('http://www.mydomain.com/version.txt') )

	if ( version_compare($query->value, $latest, '<') )

		return true;

	else

		return false;

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.