sprintlife Posted April 17, 2009 Share Posted April 17, 2009 Hey guys, Here is what I am doing. I am storing images on Amazon S3 cloud and Mosso cloud systems. What I want to do is ping Amazon S3 cloud first to make sure it's online and if it's not I ping the second one that being Mosso cloud system to see if it's online. The mosso cloud is like a back up in a way. So here is my function code. Tell me if there is a better way on doing this... // constants.php file define("AMAZON_IMAGES", "s3.amazonaws.com"); define("MOSSO_IMAGES", "cdn.cloudfiles.mosso.com"); // function.php file function images_ping3rdparties($amazonURL, $mossoURL){ // Going to check if Amazon is working first, if it's not we switch the user over to Mosso. // If Mosso down we give the user an error. // Amazon = 2, Mosso = 1, Error = 0 $amazon = @fsockopen("$amazonURL", 80, $errno, $errstr, 2); $mosso = @fsockopen("$mossoURL", 80, $errno, $errstr, 2); if(!$amazon) { if(!$mosso) { $status = '0'; } else { $status = '1'; fclose($mosso); //fclose($amazon); } } else { $status = '2'; fclose($mosso); fclose($amazon); } return $status; } Link to comment https://forums.phpfreaks.com/topic/154557-ping-amazon-s3-and-mosso-cloud-this-there-a-better-way/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.