1
0
mirror of synced 2025-02-16 23:13:15 +03:00

upd restApi client

This commit is contained in:
Grisha Pomadchin 2014-06-20 17:59:52 +04:00
parent ea4348a856
commit 5c492b6e9c

View File

@ -161,6 +161,29 @@ class RestApi
return $result;
}
/**
* Получение списка клиентов в соответсвии с запросом
*
* @param string $phone - телефон
* @param string $email - почтовый адрес
* @param string $fio - фио пользователя
* @param int $limit - ограничение на размер выборки
* @param int $offset - сдвиг
* @return array - массив клиентов
*/
public function customers($phone = null, $email = null, $fio = null, $limit = 200, $offset = 0)
{
$url = $this->apiUrl.'customers';
$this->parameters['phone'] = $phone;
$this->parameters['email'] = $email;
$this->parameters['fio'] = $fio;
$this->parameters['limit'] = $limit;
$this->parameters['offset'] = $offset;
$result = $this->curlRequest($url);
return $result;
}
/**
* Создание клиента
*
@ -534,9 +557,11 @@ class RestApi
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
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_TIMEOUT, 30); // times out after 30s
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
if ($method == 'POST')
{
@ -575,4 +600,4 @@ class RestApi
return reset($result);
}
}
}