コード例 #1
0
ファイル: HttpManager.php プロジェクト: Emon0526/zhuoying-wx
 private static function exeBySetTimes($count, $curl)
 {
     $result = curl_exec($curl);
     if (curl_errno($curl)) {
         LogUtils::debug("请求错误: " . curl_errno($curl));
         if ($count > 0) {
             $count--;
             $result = HttpManager::exeBySetTimes($count, $curl);
         }
     }
     return $result;
 }
コード例 #2
0
 public static function getFastestRealTime($hosts)
 {
     $mint = 60.0;
     $s_url = "";
     for ($i = 0; $i < count($hosts); $i++) {
         $start = array_sum(explode(" ", microtime()));
         try {
             $homepage = HttpManager::httpHead($hosts[$i]);
         } catch (Exception $e) {
             echo $e;
         }
         $ends = array_sum(explode(" ", microtime()));
         $diff = $ends - $start;
         if ($mint > $diff) {
             $mint = $diff;
             $s_url = $hosts[$i];
         }
     }
     return $s_url;
 }
コード例 #3
0
 /**
  * @param $count
  * @param $curl
  * @return mixed
  */
 private static function exeBySetTimes($count, $curl)
 {
     $result = curl_exec($curl);
     if (curl_errno($curl)) {
         LogUtils::debug('请求错误: ' . curl_errno($curl));
         if ($count > 0) {
             sleep(3);
             //Sleep 3 seconds to save cpu power
             $count--;
             $result = HttpManager::exeBySetTimes($count, $curl);
         }
     }
     return $result;
 }
コード例 #4
0
ファイル: IGt.Push.php プロジェクト: eyblog/library
 public function close()
 {
     $params = array();
     $params["action"] = "close";
     $params["appkey"] = $this->appKey;
     HttpManager::httpPostJson($this->host, $params, false);
 }
コード例 #5
0
ファイル: HttpManager.php プロジェクト: xiaoxianlink/weixin
 private static function exeBySetTimes($count, $curl)
 {
     $result = curl_exec($curl);
     $info = curl_getinfo($curl);
     $code = $info["http_code"];
     if (curl_errno($curl) != 0 && $code != 200) {
         LogUtils::debug("request errno: " . curl_errno($curl) . ",url:" . $info["url"]);
         $count--;
         if ($count > 0) {
             $result = HttpManager::exeBySetTimes($count, $curl);
         }
     }
     return $result;
 }
コード例 #6
0
ファイル: IGeTui.php プロジェクト: getuisdk/getui-php-sdk
 /**
  * @throws RequestException
  */
 public function close()
 {
     $params = array();
     $params['action'] = 'close';
     $params['appkey'] = $this->appkey;
     HttpManager::httpPostJson($this->host, $params, false);
 }