1
0
mirror of synced 2024-11-25 06:46:07 +03:00

+statisticUpdate; +30s timeout

This commit is contained in:
Grisha Pomadchin 2013-07-29 12:38:42 +04:00
parent a647993272
commit 7ac3170b76

View File

@ -443,8 +443,17 @@ class RestApi
return $result; return $result;
} }
/**
* Обновление статистики
*
* @return array - статус вып обновления
*/
public function statisticUpdate()
{
$url = $this->apiUrl.'statistic/update';
$result = $this->curlRequest($url);
return $result;
}
protected function curlRequest($url, $method = 'GET', $format = 'json') protected function curlRequest($url, $method = 'GET', $format = 'json')
{ {
@ -456,7 +465,7 @@ class RestApi
curl_setopt($ch, CURLOPT_FAILONERROR, FALSE); curl_setopt($ch, CURLOPT_FAILONERROR, FALSE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable
curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 3s curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 30s
if ($method == 'POST') if ($method == 'POST')
{ {