private static function closeConnection() { if (self::$curl != null) { curl_close(self::$curl); } self::$curl = null; }
private static function closeConnection() { KalturaLog::debug("Closing connection"); if (self::$curl != null) { curl_close(self::$curl); } self::$curl = null; }
/** * @param string $url * @param string $signature_key * @param array $not_list * @return array */ private function sendMultiNotifications($url, $signature_key, array $not_list) { KalturaLog::debug("sendMultiNotifications({$url}, {$signature_key}, " . count($not_list) . ")"); $start_time = microtime(true); $params = array(); $index = 1; $not_id_str = ""; foreach ($not_list as $not) { $prefix = "not{$index}_"; list($notification_params, $raw_siganture) = KAsyncNotifierParamsUtils::prepareNotificationData($url, $signature_key, $not, $not->data, $prefix); $index++; $params = array_merge($params, $notification_params); $not_id_str .= $not->id . ", "; } $params["multi_notification"] = "true"; $params["number_of_notifications"] = count($not_list); //the "sig" parameter will be overidden - so eventually only the last will remain list($params, $raw_siganture) = KAsyncNotifierParamsUtils::signParams($signature_key, $params); try { list($params, $result, $http_code) = KAsyncNotifierSender::send($url, $params); } catch (Exception $ex) { // try a second time - the connection will probably be closed try { list($params, $result, $http_code) = KAsyncNotifierSender::send($url, $params); } catch (Exception $ex) { KalturaLog::err('sendMultiNotifications failed second try with message: ' . $ex->getMessage()); } } $end_time = microtime(true); KalturaLog::info("partner [{$not->partnerId}] notification [{$not_id_str}] to [{$url}]\nhttp result code [{$http_code}]\n" . print_r($params, true) . "\nresult [{$result}]\nraw_signature [{$raw_siganture}]\ntook [" . ($end_time - $start_time) . "]"); // see if the hit worked properly // the hit should return a specific string to indicate a success return array($params, $result, $http_code); }