Пример #1
0
 public static function falloff_retry_ex()
 {
     $response = '';
     $url = "http://www.reddit.com/.json";
     Consistency::falloff_retry(function () use($url, &$response) {
         if (rand(0, 2) == 0) {
             $response = file_get_contents($url);
         } else {
             throw new Exception("Intermittent failure");
         }
     });
     echo md5($response) . "\n";
 }