本文整理汇总了PHP中Http::send方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::send方法的具体用法?PHP Http::send怎么用?PHP Http::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Http
的用法示例。
在下文中一共展示了Http::send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* The main routing function to call in web interceptor/index
* The approach is simple as possible
*/
public static function init()
{
/* Catch http request */
$request = new HttpRequest();
/* Check if reserved controller 'main' requestes */
if ($request->queryStartsFrom('/main')) {
/* Finish here */
Http::sendError(404);
}
/* Choose controller */
if (!($reference = self::chooseController($request))) {
/* Or finish here */
Http::sendError(404);
}
/* Route request */
if (!($response = self::route($reference, $request))) {
/* Or finish here */
Http::sendError(404);
}
/* Sending final response
* JSON
*/
if ($response['type'] === 'json') {
Http::sendJSON($response['data']);
}
/* OR plain html */
Http::send($response['data']);
}
示例2: pornDetectFile
/**
* 智能鉴黄-Files
* @param string $pornFile 要进行黄图检测的图片File列表
*/
public static function pornDetectFile($pornFile)
{
$sign = Auth::getPornDetectSign();
if (false === $sign) {
$data = array("code" => 9, "message" => "Secret id or key is empty.", "data" => array());
return $data;
}
$data = array('appid' => Conf::APPID, 'bucket' => Conf::BUCKET);
for ($i = 0; $i < count($pornFile); $i++) {
if (PATH_SEPARATOR == ';') {
// WIN OS
$pornFile[$i] = iconv("UTF-8", "gb2312", $pornFile[$i]);
}
$srcPath = realpath($pornFile[$i]);
if (!file_exists($srcPath)) {
return array('httpcode' => 0, 'code' => self::IMAGE_FILE_NOT_EXISTS, 'message' => 'file ' . $pornFile[$i] . ' not exists', 'data' => array());
}
if (function_exists('curl_file_create')) {
$data['image[' . (string) $i . ']'] = curl_file_create($srcPath, NULL, $pornFile[$i]);
} else {
$data['image[' . (string) $i . ']'] = '@' . $srcPath;
}
}
$req = array('url' => Conf::API_PRONDETECT_URL, 'method' => 'post', 'timeout' => self::TIME_OUT, 'data' => $data, 'header' => array('Authorization:' . $sign));
$rsp = Http::send($req);
return $rsp;
}
示例3: tickets
/**
* 导入工单
* @param array $data
* @throws MissingParametersException
* @throws ResponseException
* @return mixed
*/
public function tickets($data = '')
{
$url = 'imports/tickets';
$this->validatePara('array', $data, 'data', __METHOD__);
$data = array('ticket' => $data);
$response = Http::send($this->client, $url, $data, 'POST');
return $this->validateResponse($response, __METHOD__);
}
示例4: activate
public function activate(array $params) {
$endPoint = Http::prepare('/mail/activate.json');
$response = json_decode(Http::send($this->apicaller, $endPoint, $params, 'GET'));
if (!is_object($response)) {
throw new ResponseException(__METHOD__);
}
return $response;
}
示例5: delete
/**
* 删除指定客服组
* @param int $group_id
* @throws MissingParametersException
* @throws ResponseException
* @return mixed
*/
public function delete($group_id = '')
{
$url = 'groups';
$this->validatePara('int', $group_id, 'group_id', __METHOD__);
$url = $url . '/' . $group_id;
Http::send($this->client, $url, '', 'DELETE');
return $this->validateResponse('', __METHOD__, 'delete');
}
示例6: getDnsRecords
public function getDnsRecords(array $params) {
$endPoint = Http::prepare('domainforward/dns-records.json');
$response = json_decode(Http::send($this->apicaller, $endPoint, $params, 'GET'));
if (!is_object($response)) {
throw new ResponseException(__METHOD__);
}
return $response;
}
示例7: tickets
/**
* 导出工单
* @param array $data
* @throws MissingParametersException
* @throws ResponseException
* @return mixed
*/
public function tickets($data = '')
{
$url = 'exports/tickets';
if ($data) {
$this->validatePara('array', $data, 'data', __METHOD__);
$url = $url . '?' . http_build_query($data);
}
$response = Http::send($this->client, $url);
return $this->validateResponse($response, __METHOD__);
}
示例8: update
/**
* Update one or more settings
*
* @param array $params
*
* @throws ResponseException
* @throws \Exception
*
* @return mixed
*/
public function update(array $params)
{
$endPoint = Http::prepare('account/settings.json');
$response = Http::send($this->client, $endPoint, array(self::OBJ_NAME => $params), 'PUT');
if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 200) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return $response;
}
示例9: findAll
/**
* Returns a list of sharing agreements
*
* @param array $params
*
* @throws ResponseException
* @throws \Exception
*
* @return mixed
*/
public function findAll(array $params = array())
{
$endPoint = Http::prepare('sharing_agreements.json', null, $params);
$response = Http::send($this->client, $endPoint);
if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 200) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return $response;
}
示例10: delete
/**
* Unregister the mobile devices that are receiving push notifications
*
* @param array $devices
*
* @throws MissingParametersException
* @throws ResponseException
* @throws \Exception
*
* @return bool
*/
public function delete(array $devices = array())
{
$endPoint = Http::prepare('push_notification_devices/destroy_many.json');
$response = Http::send($this->client, $endPoint, array("push_notification_devices" => $devices), 'POST');
if ($this->client->getDebug()->lastResponseCode != 200) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return true;
}
示例11: importMany
/**
* Create multiple new tickets
*
* @param array $params
*
* @throws ResponseException
* @throws \Exception
*
* @return mixed
*/
public function importMany(array $params)
{
$endPoint = Http::prepare('imports/tickets/create_many.json');
$response = Http::send($this->client, $endPoint, array(self::OBJ_NAME_PLURAL => $params), 'POST');
if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 200) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return $response;
}
示例12: create
/**
* Create a voice or voicemail ticket
*
* @param array $params
*
* @throws ResponseException
* @throws \Exception
*
* @return mixed
*/
public function create(array $params)
{
$endPoint = Http::prepare('channels/voice/tickets.json');
$response = Http::send($this->client, $endPoint, $params, 'POST');
// note: specify the whole package
if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 201) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return $response;
}
示例13: findAll
/**
* List all stats
*
* @param array $params
*
* @throws MissingParametersException
* @throws ResponseException
* @throws \Exception
*
* @return mixed
*/
public function findAll(array $params = array())
{
if (!$this->hasAnyKey($params, array('current_queue_activity', 'historical_queue_activity', 'agents_activity'))) {
throw new MissingParametersException(__METHOD__, array('current_queue_activity', 'historical_queue_activity', 'agents_activity'));
}
$endPoint = Http::prepare(isset($params['current_queue_activity']) ? 'channels/voice/stats/current_queue_activity.json' : (isset($params['historical_queue_activity']) ? 'channels/voice/stats/historical_queue_activity.json' : (isset($params['agents_activity']) ? 'channels/voice/stats/agents_activity.json' : '')), null, $params);
$response = Http::send($this->client, $endPoint);
if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 200) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return $response;
}
示例14: openTicket
/**
* Opens a ticket in an agent's browser
*
* @param array $params
*
* @throws MissingParametersException
* @throws ResponseException
* @throws \Exception
*
* @return bool
*/
public function openTicket(array $params = array())
{
if (!$this->hasKeys($params, array('agent_id', 'ticket_id'))) {
throw new MissingParametersException(__METHOD__, array('agent_id', 'ticket_id'));
}
$endPoint = Http::prepare('channels/voice/agents/' . $params['agent_id'] . '/tickets/' . $params['ticket_id'] . '/display.json');
$response = Http::send($this->client, $endPoint, null, 'POST');
if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 200) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return true;
}
示例15: tags
/**
* Submits a request for matching tags
*
* @param array $params
*
* @throws MissingParametersException
* @throws ResponseException
* @throws \Exception
* @return mixed
*/
public function tags(array $params)
{
if (!$this->hasKeys($params, array('name'))) {
throw new MissingParametersException(__METHOD__, array('name'));
}
$endPoint = Http::prepare('autocomplete/tags.json');
$response = Http::send($this->client, $endPoint, array(self::OBJ_NAME => $params['name']), 'POST');
if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 200) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return $response;
}