当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::delete方法代码示例

本文整理汇总了PHP中Unirest\Request::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::delete方法的具体用法?PHP Request::delete怎么用?PHP Request::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Unirest\Request的用法示例。


在下文中一共展示了Request::delete方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleteAll

 public static function deleteAll($headers = null)
 {
     if (!$headers) {
         $headers = Rapid::getAuthHeader();
     }
     $response = Request::delete(Rapid::getUrl(self::$route), $headers);
     return Response::make($response);
 }
开发者ID:radiegtya,项目名称:rapid-api-php,代码行数:8,代码来源:Texts.php

示例2: deleteInfo

 public function deleteInfo($url, $inputs = null, $param = null)
 {
     $url = setApiUrl($url, $param);
     //Log::info($url);
     $response = Unirest\Request::delete($url, $this->_headers, json_encode($inputs));
     //Log::info(json_encode($response));
     return dealResponse($response);
 }
开发者ID:cloudapidev,项目名称:apibay,代码行数:8,代码来源:Ossbss.php

示例3: deleteAddress

 /**
  * Delete an address from your account
  * @param  int        $addressId        Required parameter: The identifier of the address
  * @return mixed response from the API call*/
 public function deleteAddress($addressId)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::BASEURI;
     $queryBuilder = Config::get('voxbone.base_uri');
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/regulation/address/{addressId}';
     //process optional query parameters
     APIHelper::appendUrlWithTemplateParameters($queryBuilder, array('addressId' => $addressId));
     //validate and preprocess url
     $queryUrl = APIHelper::cleanUrl($queryBuilder);
     //prepare headers
     $headers = array('User-Agent' => 'APIMATIC 2.0', 'Accept' => 'application/json', 'Content-type' => 'application/json; charset=utf-8');
     //prepare API request
     $response = Request::delete($queryUrl, $headers);
     //and invoke the API call request to fetch the response
     //$response = Unirest::getResponse($request);
     //Error handling using HTTP status codes
     if ($response->code < 200 || $response->code > 206) {
         //[200,206] = HTTP OK
         return $response;
     }
     return $response->body;
 }
开发者ID:mannysoft,项目名称:voxboneapiclient,代码行数:28,代码来源:RegulationController.php

示例4: deleteInfo

 public function deleteInfo($doUrl, $inputs, $number = null)
 {
     $url = setApiUrl($doUrl, $number);
     $response = Unirest\Request::delete($url, $this->_headers, json_encode($inputs));
     if ($response->code == 200) {
         // 			return $response->body;
         return 1;
     }
     return 0;
 }
开发者ID:cloudapidev,项目名称:apibay,代码行数:10,代码来源:Numberapi.php

示例5: array

 // Start Transaction so if the daemon errors we can rollback changes
 ORM::get_db()->beginTransaction();
 $node = ORM::forTable('nodes')->findOne($core->server->getData('node'));
 $ports = json_decode($node->ports, true);
 $ips = json_decode($node->ips, true);
 $ports[$core->server->getData('server_ip')][$core->server->getData('server_port')]++;
 $ips[$core->server->getData('server_ip')]['ports_free']++;
 $node->ips = json_encode($ips);
 $node->ports = json_encode($ports);
 $node->save();
 ORM::forTable('subusers')->where('server', $core->server->getData('id'))->deleteMany();
 ORM::forTable('permissions')->where('server', $core->server->getData('id'))->deleteMany();
 ORM::forTable('downloads')->where('server', $core->server->getData('id'))->deleteMany();
 ORM::forTable('servers')->where('id', $core->server->getData('id'))->deleteMany();
 try {
     $unirest = Request::delete("https://" . $core->server->nodeData('fqdn') . ":" . $core->server->nodeData('daemon_listen') . "/server", array('X-Access-Token' => $core->server->nodeData('daemon_secret'), 'X-Access-Server' => $core->server->getData('hash')));
     if ($unirest->code !== 204) {
         throw new Exception('<div class="alert alert-danger">Scales returned an error when trying to process your request. Scales said: ' . $unirest->raw_body . ' [HTTP/1.1 ' . $unirest->code . ']</div>');
     }
     ORM::get_db()->commit();
     $service->flash('<div class="alert alert-success">The requested server has been deleted from PufferPanel.</div>');
     $response->redirect('/admin/server')->send();
 } catch (Exception $e) {
     Debugger::log($e);
     if ($request->param('force') && $request->param('force') === "force") {
         ORM::get_db()->commit();
         $service->flash('<div class="alert alert-danger">An error was encountered with the daemon while trying to delete this server from the system. <strong>Because you requested a force delete this server has been removed from the panel regardless of the reason for the error. This server and its data may still exist on the Scales instance.</strong></div>');
         $response->redirect('/admin/server')->send();
         return;
     }
     ORM::get_db()->rollBack();
开发者ID:CamTosh,项目名称:PufferPanel,代码行数:31,代码来源:routes.php

示例6: deleteContactList

 /**
  * Delete a specific contact list
  * @param  int     $listId      Required parameter: Example: 
  * @return string response from the API call*/
 public function deleteContactList($listId)
 {
     //check that all required arguments are provided
     if (!isset($listId)) {
         throw new \InvalidArgumentException("One or more required arguments were NULL.");
     }
     //the base uri for api requests
     $_queryBuilder = Configuration::$BASEURI;
     //prepare query string for API call
     $_queryBuilder = $_queryBuilder . '/lists/{list_id}';
     //process optional query parameters
     APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array('list_id' => $listId));
     //validate and preprocess url
     $_queryUrl = APIHelper::cleanUrl($_queryBuilder);
     //prepare headers
     $_headers = array('user-agent' => 'ClickSendSDK');
     //set HTTP basic auth parameters
     Request::auth(Configuration::$username, Configuration::$key);
     //and invoke the API call request to fetch the response
     $response = Request::delete($_queryUrl, $_headers);
     //Error handling using HTTP status codes
     if ($response->code == 400) {
         throw new APIException('BAD_REQUEST', 400, $response->body);
     } else {
         if ($response->code == 401) {
             throw new APIException('UNAUTHORIZED', 401, $response->body);
         } else {
             if ($response->code == 403) {
                 throw new APIException('FORBIDDEN', 403, $response->body);
             } else {
                 if ($response->code == 404) {
                     throw new APIException('NOT_FOUND', 404, $response->body);
                 } else {
                     if ($response->code == 405) {
                         throw new APIException('METHOD_NOT_FOUND', 405, $response->body);
                     } else {
                         if ($response->code == 429) {
                             throw new APIException('TOO_MANY_REQUESTS', 429, $response->body);
                         } else {
                             if ($response->code == 500) {
                                 throw new APIException('INTERNAL_SERVER_ERROR', 500, $response->body);
                             } else {
                                 if ($response->code < 200 || $response->code > 206) {
                                     //[200,206] = HTTP OK
                                     throw new APIException("HTTP Response Not OK", $response->code, $response->body);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $response->body;
 }
开发者ID:clicksend,项目名称:clicksend-php,代码行数:59,代码来源:ContactListController.php

示例7: function

namespace PufferPanel\Core;

use Unirest;
$klein->respond('POST', '/node/ajax/files/[*]', function () use($core) {
    $core->routes = new Router\Router_Controller('Node\\Ajax\\Files', $core->server);
    $core->routes = $core->routes->loadClass();
});
$klein->respond('POST', '/node/ajax/files/delete', function ($request, $response) use($core) {
    if (!$core->permissions->has('files.delete')) {
        $response->code(403)->body("You are not authorized to perform this action.")->send();
        return;
    }
    $unirest = (object) array("code" => 500, "raw_body" => "Invalid function passed.");
    if ($request->param('deleteItemPath') && !empty($request->param('deleteItemPath'))) {
        try {
            $unirest = Unirest\Request::delete("https://" . $core->server->nodeData('fqdn') . ":" . $core->server->nodeData('daemon_listen') . "/server/file/" . rawurlencode($request->param('deleteItemPath')), array('X-Access-Token' => $core->server->getData('daemon_secret'), 'X-Access-Server' => $core->server->getData('hash')));
        } catch (\Exception $e) {
            \Tracy\Debugger::log($e);
            $response->code(500)->body("Unirest response error.")->send();
            return;
        }
    }
    if ($unirest->code !== 204) {
        $response->code($unirest->code)->body($unirest->raw_body)->send();
        return;
    }
    $response->code(200)->body("ok")->send();
});
$klein->respond('POST', '/node/ajax/files/compress', function ($request, $response) use($core) {
    if (!$core->permissions->has('files.zip')) {
        $response->code(403)->body("You are not authorized to perform this action.")->send();
开发者ID:PhenixH,项目名称:PufferPanel,代码行数:31,代码来源:routes.php

示例8: delete

 public function delete($path, $parameter = [])
 {
     return Request::delete($this->base_uri . $path, [], $parameter);
 }
开发者ID:tubecode,项目名称:tubecode,代码行数:4,代码来源:Client.php

示例9: delete

 /**
  * @param string $uri
  * @param array $query
  *
  * @return Response
  */
 public function delete($uri, $query = [])
 {
     $headers = ['Accept' => 'application/json', 'X-IFSISTEM-TOKEN' => $this->token, 'X-IFSISTEM-DIL-ID' => $this->dilId];
     return Request::delete($this->uri . $uri, $headers, $query);
 }
开发者ID:ifyazilim,项目名称:ifsistem-php-sdk,代码行数:11,代码来源:ApiService.php

示例10: testDelete

 public function testDelete()
 {
     $response = Request::delete('http://mockbin.com/request', array('Accept' => 'application/json', 'Content-Type' => 'application/x-www-form-urlencoded'), array('name' => 'Mark', 'nick' => 'thefosk'));
     $this->assertEquals(200, $response->code);
     $this->assertEquals('DELETE', $response->body->method);
 }
开发者ID:RusinovIG,项目名称:unirest-php,代码行数:6,代码来源:RequestTest.php

示例11: call

 /**
  * The underlying call to the Kong Server
  *
  * @throws \Ignittion\Kong\KongException when something goes wrong with the Http request
  *
  * @param string $verb
  * @param string $uri
  * @param array $options
  * @param array $body
  * @return \stdClass
  */
 public function call($verb, $uri, array $params = [], array $body = [], array $headers = [])
 {
     $verb = strtoupper($verb);
     $api = "{$this->url}:{$this->port}/{$uri}";
     $headers = array_merge($headers, ['Content-Type: application/json']);
     try {
         switch ($verb) {
             case 'GET':
                 $request = RestClient::get($api, $headers, $params);
                 break;
             case 'POST':
                 $request = RestClient::post($api, $headers, $body);
                 break;
             case 'PUT':
                 $request = RestClient::put($api, $headers, $body);
                 break;
             case 'PATCH':
                 $request = RestClient::patch($api, $headers, $body);
                 break;
             case 'DELETE':
                 $request = RestClient::delete($api, $headers);
                 break;
             default:
                 throw new Exception('Unknown HTTP Request method.');
         }
     } catch (Exception $e) {
         throw new KongException($e->getMessage());
     }
     // save this request
     $this->body = $request->body;
     $this->headers = $request->headers;
     $this->httpCode = $request->code;
     $this->rawBody = $request->raw_body;
     // return a more simplified response
     $object = new stdClass();
     $object->code = $this->httpCode;
     $object->data = $this->body;
     return $object;
 }
开发者ID:ignittion,项目名称:kong-php,代码行数:50,代码来源:AbstractApi.php

示例12: deletePhoto

 /**
  * Удаление фотографии.
  *
  * <h1>Примеры</h1>
  *
  * <h2>Удаление альбома</h2>
  * <code>
  * <?php
  * $api->deletePhoto(12345678);
  * ?>
  * </code>
  *
  * @param int $photoId Id фотографии, которую нужно удалить
  *
  * @return $this
  * @throws \Yandex\Fotki\Exception\Api\Photo
  */
 public function deletePhoto($photoId)
 {
     $apiUrl = sprintf("http://api-fotki.yandex.ru/api/users/%s/photo/%s/", $this->_login, intval($photoId));
     $oAuthToken = $this->_transport->getOAuthToken();
     $fimpToken = $this->_transport->getFimpToken();
     $response = Request::delete($apiUrl, array('Authorization' => $oAuthToken ? "OAuth {$oAuthToken}" : "FimpToken realm=\"fotki.yandex.ru\", token=\"{$fimpToken}\""));
     if ($response->code === 204) {
         return $this;
     } else {
         throw new \Yandex\Fotki\Exception\Api\Photo($response->body, $response->code);
     }
 }
开发者ID:romka-chev,项目名称:php-yandex-fotki,代码行数:29,代码来源:Api.php


注:本文中的Unirest\Request::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。