當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Http::send方法代碼示例

本文整理匯總了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']);
 }
開發者ID:wake-up-neo,項目名稱:php-xframework,代碼行數:32,代碼來源:Router.php

示例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;
 }
開發者ID:tencentyun,項目名稱:php-sdk,代碼行數:31,代碼來源:ImageProcess.php

示例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__);
 }
開發者ID:KF5,項目名稱:PHP-SDK,代碼行數:15,代碼來源:Imports.php

示例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;
 }
開發者ID:jinguanio,項目名稱:RClubAPI_NEW,代碼行數:8,代碼來源:FreeEmailService.php

示例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');
 }
開發者ID:KF5,項目名稱:PHP-SDK,代碼行數:15,代碼來源:Groups.php

示例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;
    }
開發者ID:jinguanio,項目名稱:RClubAPI_NEW,代碼行數:9,代碼來源:DomainForwardingService.php

示例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__);
 }
開發者ID:KF5,項目名稱:PHP-SDK,代碼行數:17,代碼來源:Exports.php

示例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;
 }
開發者ID:jorgevrgs,項目名稱:zendesk_api_client_php,代碼行數:20,代碼來源:Settings.php

示例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;
 }
開發者ID:heitorglockner,項目名稱:zendesk_api_client_php,代碼行數:20,代碼來源:SharingAgreements.php

示例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;
 }
開發者ID:heitorglockner,項目名稱:zendesk_api_client_php,代碼行數:21,代碼來源:PushNotificationDevices.php

示例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;
 }
開發者ID:paperray,項目名稱:zendeskapi,代碼行數:20,代碼來源:TicketImport.php

示例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;
 }
開發者ID:heitorglockner,項目名稱:zendesk_api_client_php,代碼行數:21,代碼來源:VoiceTickets.php

示例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;
 }
開發者ID:jorgevrgs,項目名稱:zendesk_api_client_php,代碼行數:24,代碼來源:VoiceStats.php

示例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;
 }
開發者ID:jorgevrgs,項目名稱:zendesk_api_client_php,代碼行數:24,代碼來源:VoiceAgents.php

示例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;
 }
開發者ID:heitorglockner,項目名稱:zendesk_api_client_php,代碼行數:23,代碼來源:Autocomplete.php


注:本文中的Http::send方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。