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


PHP Request::put方法代码示例

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


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

示例1: updatePhoto

 /**
  * Редактирование фотографии
  *
  * <h1>Примеры</h1>
  *
  * <h2>Изменение заголовка</h2>
  * <code>
  * <?php
  * $photo = $api->getPhoto(12345678)->load();
  * $photo->setTitle('Новое название');
  *
  * $updatedPhoto = $api->updatePhoto($photo)->load();
  * echo $updatedPhoto->getTitle();
  * ?>
  * </code>
  *
  * <h2>Изменение ссылки на родительский альбом</h2>
  * <code>
  * <?php
  * $photo = $api->getPhoto(12345678)->load();
  * $photo->setAlbumId(654321);
  *
  * $updatedPhoto = $api->updatePhoto($photo)->load();
  * echo $updatedPhoto->getAlbumId();
  * ?>
  * </code>
  *
  * @param \Yandex\Fotki\Api\Photo $photo
  *
  * @return \Yandex\Fotki\Api\Photo Фотография, которую нужно обновить
  * @throws \Yandex\Fotki\Exception\Api\Photo Если призошла ошибка во время запроса на обновление
  * @throws \Yandex\Fotki\Exception\InvalidCall Если произошла ошибка при геренации XML
  */
 public function updatePhoto(Photo $photo)
 {
     $oAuthToken = $this->_transport->getOAuthToken();
     $fimpToken = $this->_transport->getFimpToken();
     $body = $photo->getAtomEntryForSave()->asXML();
     $headers = array('Authorization' => $oAuthToken ? "OAuth {$oAuthToken}" : "FimpToken realm=\"fotki.yandex.ru\", token=\"{$fimpToken}\"", 'Content-Type' => 'application/atom+xml; type=entry');
     $response = Request::put($photo->getApiUrlEdit(), $headers, $body);
     if ($response->code === 200) {
         $url = sprintf("http://api-fotki.yandex.ru/api/users/%s/photo/%s/?format=json", $this->_login, intval($photo->getId()));
         return new Photo($this->_transport, $url);
     } else {
         throw new \Yandex\Fotki\Exception\Api\Photo($response->body, $response->code);
     }
 }
开发者ID:romka-chev,项目名称:php-yandex-fotki,代码行数:47,代码来源:Api.php

示例2: put

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

示例3: updateBookingStatus

 /**
  * Updates Booking status information.Newly created booking has status `reserved`. In this status BeMyGuest inventory is not yet deducted.Inventory is locked after changing status of the booking from `reserved` to `waiting` (`confirm` action).When the booking is first created, it is marked as `reserved`. Inventories aren't touched yet. Once the partner decides to confirm the said booking, this is the only time the inventory will be impacted. The booking status will be updated from `reserved` to `waiting`.5 days after the booking date all booking with status `waiting` will be marked `expired`.There's 3rd extra action you may invoke in this method : `resend`. If `confirmationEmailSentAt` value is not null then the confirmation email copy sent o partner will be sent again and the timestamp value of this field will be updated.In response Booking object is returned, for example        {          "data": {              "uuid": "c53cbc74-1efa-58bb-afef-750afc52cd75",              "totalAmount": "123.98",              "currencyCode": "SGD",              "currencyUuid": "cd15153e-dfd1-5039-8aa3-115bec58e86e",              "totalAmountRequestCurrency": "369.46",              "requestCurrencyCode": "MYR",              "requestCurrencyUuid": "e98aaf89-ae5a-5c11-859a-b36f2c8e13c7",              "createdAt": "2015-12-21 19:53:23",              "updatedAt": "2015-12-21 19:53:23",              "arrivalDate": "2016-02-21",              "salutation": "Mr.",              "firstName": "test",              "lastName": "test",              "email": "test@126.com",              "phone": "123456789",              "guests": 2,              "children": 0,              "partnerReference": "test93828",              "confirmationEmailSentAt": null,              "confirmationEmailFiles": [],              "status": "reserved",              "productTypeTitle": "14% OFF for Family: E-Ticket to Universal Studios Singapore",              "productTypeTitleTranslated": "14% OFF for Family: E-Ticket to Universal Studios Singapore",              "productTypeUuid": "9b967f1a-89c2-5083-a758-e359deb2af9b"            }        }### Parameters+ uuid (required,string) - UUID of booking+ status (string) - Status "confirm" or "cancel"
  * @param  string                   $status     Required parameter: New status of the booking, one of [confirm, cancel, resend]
  * @param  string                   $uuid       Required parameter: UUID of booking
  * @param  Models\UpdateBookingRequest $data       Optional parameter: Example: 
  * @return mixed response from the API call
  * @throws APIException Thrown if API call fails
  */
 public function updateBookingStatus($status, $uuid, $data = NULL)
 {
     //the base uri for api requests
     $_queryBuilder = Configuration::$BASEURI;
     //prepare query string for API call
     $_queryBuilder = $_queryBuilder . '/v1/bookings/{uuid}/{status}';
     //process optional query parameters
     APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array('status' => $status, 'uuid' => $uuid));
     //validate and preprocess url
     $_queryUrl = APIHelper::cleanUrl($_queryBuilder);
     //prepare headers
     $_headers = array('user-agent' => 'BeMyGuest.SDK.v1', 'Accept' => 'application/json', 'content-type' => 'application/json; charset=utf-8', 'X-Authorization' => Configuration::$xAuthorization);
     //call on-before Http callback
     $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl);
     if ($this->getHttpCallBack() != null) {
         $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest);
     }
     //and invoke the API call request to fetch the response
     $response = Request::put($_queryUrl, $_headers, Request\Body::Json($data));
     //call on-after Http callback
     if ($this->getHttpCallBack() != null) {
         $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body);
         $_httpContext = new HttpContext($_httpRequest, $_httpResponse);
         $this->getHttpCallBack()->callOnAfterRequest($_httpContext);
     }
     //Error handling using HTTP status codes
     if ($response->code == 400) {
         throw new APIException('Wrong Arguments', $_httpContext);
     } else {
         if ($response->code == 401) {
             throw new APIException('Unauthorized', $_httpContext);
         } else {
             if ($response->code == 403) {
                 throw new APIException('Forbidden', $_httpContext);
             } else {
                 if ($response->code == 404) {
                     throw new APIException('Resource Not Found', $_httpContext);
                 } else {
                     if ($response->code == 405) {
                         throw new APIException('Method Not Allowed', $_httpContext);
                     } else {
                         if ($response->code == 410) {
                             throw new APIException('Resource No Longer Available', $_httpContext);
                         } else {
                             if ($response->code < 200 || $response->code > 208) {
                                 //[200,208] = HTTP OK
                                 throw new APIException("HTTP Response Not OK", $_httpContext);
                             }
                         }
                     }
                 }
             }
         }
     }
     $mapper = $this->getJsonMapper();
     return $mapper->map($response->body, new Models\UpdateBookingStatusResponse());
 }
开发者ID:bemyguest,项目名称:sdk-php,代码行数:65,代码来源:BookingsController.php

示例4: transferCredit

 /**
  * Transfer Credit
  * @param  string     $clientUserId       Required parameter: Example: 
  * @param  int        $balance            Required parameter: Example: 
  * @param  string     $currency           Required parameter: Example: 
  * @return string response from the API call*/
 public function transferCredit($clientUserId, $balance, $currency)
 {
     //check that all required arguments are provided
     if (!isset($clientUserId, $balance, $currency)) {
         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 . '/reseller/transfer-credit';
     //process optional query parameters
     APIHelper::appendUrlWithQueryParameters($_queryBuilder, array('client_user_id' => $clientUserId, 'balance' => $balance, 'currency' => $currency));
     //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::put($_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,代码行数:61,代码来源:TransferCreditController.php

示例5: updateCart

 /**
  * Create a new cart
  * @param  CartCreateModel     $body     Required parameter: TODO: type description here
  * @return mixed response from the API call*/
 public function updateCart($body)
 {
     //the base uri for api requests
     $queryBuilder = Configuration::BASEURI;
     $queryBuilder = Config::get('voxbone.base_uri');
     //prepare query string for API call
     $queryBuilder = $queryBuilder . '/ordering/cart';
     //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::put($queryUrl, $headers, json_encode($body));
     //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,代码行数:26,代码来源:OrderingController.php

示例6: function

$klein->respond('GET', '/node/files/add/[*:directory]?', function ($request, $response, $service) use($core) {
    if (!$core->permissions->has('files.create') || !$core->permissions->has('files.upload')) {
        $response->code(403);
        $response->body($core->twig->render('node/403.html'))->send();
        return;
    }
    $response->body($core->twig->render('node/files/add.html', array('flash' => $service->flashes(), 'directory' => $request->param('directory'), 'server' => $core->server->getData(), 'node' => $core->server->nodeData())))->send();
});
$klein->respond('POST', '/node/files/add', function ($request, $response, $service) use($core) {
    if (!$core->permissions->has('files.create')) {
        $response->code(403);
        $response->body($core->twig->render('node/403.html'))->send();
        return;
    }
    try {
        $unirest = \Unirest\Request::put("https://" . $core->server->nodeData('fqdn') . ":" . $core->server->nodeData('daemon_listen') . "/server/file/" . rawurlencode($request->param('newFilePath')), array("X-Access-Token" => $core->server->getData('daemon_secret'), "X-Access-Server" => $core->server->getData('hash')), array("contents" => $request->param('newFileContents')));
        if ($unirest->code !== 204) {
            $response->code($unirest->code);
            $response->body('An error occured while trying to write the file to the server. [' . $unirest->body->message . ']')->send();
            return;
        }
        $response->code(200);
        $response->body('ok')->send();
        return;
    } catch (\Exception $e) {
        \Tracy\Debugger::log($e);
        $response->code(500);
        $response->body('An execption occured when trying to connect to the server.')->send();
        return;
    }
});
开发者ID:PhenixH,项目名称:PufferPanel,代码行数:31,代码来源:routes.php

示例7: putInfo

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

示例8: 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

示例9: array

        $response->redirect('/admin/server/view/' . $request->param('id'))->send();
        return;
    }
    ORM::get_db()->beginTransaction();
    $server = ORM::forTable('servers')->findOne($core->server->getData('id'));
    $server->name = $request->param('server_name');
    $server->max_ram = $request->param('alloc_mem');
    //$server->disk_space = $request->param('alloc_disk');
    $server->cpu_limit = $request->param('cpu_limit');
    $server->block_io = $request->param('block_io');
    $server->save();
    /*
     * Build the Data
     */
    try {
        Request::put("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')), array("json" => json_encode(array("cpu" => (int) $request->param('cpu_limit'), "memory" => (int) $request->param('alloc_mem'), "io" => (int) $request->param('block_io'))), "object" => "build", "overwrite" => false));
        ORM::get_db()->commit();
        $service->flash('<div class="alert alert-success">Server settings have been updated.</div>');
        $response->redirect('/admin/server/view/' . $request->param('id'))->send();
        return;
    } catch (Exception $e) {
        Debugger::log($e);
        ORM::get_db()->rollBack();
        $service->flash('<div class="alert alert-danger">An error occured while trying to connect to the remote node. Please check that Scales is running and try again.</div>');
        $response->redirect('/admin/server/view/' . $request->param('id'))->send();
        return;
    }
});
$klein->respond('GET', '/admin/server/new', function ($request, $response, $service) use($core) {
    $response->body($core->twig->render('admin/server/new.html', array('locations' => ORM::forTable('locations')->findMany(), 'plugins' => ORM::forTable('plugins')->findMany(), 'flash' => $service->flashes())))->send();
});
开发者ID:CamTosh,项目名称:PufferPanel,代码行数:31,代码来源:routes.php

示例10: revokeActiveUserPermissions

 /**
  * Revokes subuser permissions for a given user that has an active account on the panel.
  *
  * @param object $orm Database query object.
  * @return bool
  */
 public function revokeActiveUserPermissions(ORM $orm)
 {
     if (!$this->avaliable($this->server->nodeData('fqdn'), $this->server->nodeData('daemon_listen'))) {
         self::_setError("Unable to access the server management daemon.");
         return false;
     }
     if ($orm->pending == 0) {
         try {
             $unirest = Unirest\Request::put("https://" . $this->server->nodeData('fqdn') . ":" . $this->server->nodeData('daemon_listen') . "/server", array("X-Access-Token" => $this->server->nodeData('daemon_secret'), "X-Access-Server" => $this->server->getData('hash')), array("json" => json_encode(array($orm->daemon_secret => "")), "object" => "keys", "overwrite" => false));
             if ($unirest->code !== 204) {
                 throw new \Exception();
             }
             ORM::forTable('permissions')->where(array('user' => $orm->user, 'server' => $this->server->getData('id')))->delete_many();
             $orm->delete();
             return true;
         } catch (\Exception $e) {
             \Tracy\Debugger::log($e);
             self::_setError("An error occured when trying to update the server information on the daemon.");
             return false;
         }
     } else {
         ORM::forTable('account_change')->where(array('content' => $orm->email, 'type' => 'user_register'))->findOne()->delete();
         ORM::forTable('subusers')->where(array('id' => $orm->user, 'server' => $this->server->getData('id')))->findOne()->delete();
         $orm->delete();
         return true;
     }
 }
开发者ID:ByteKing,项目名称:Main,代码行数:33,代码来源:users.php

示例11: testPut

 public function testPut()
 {
     $response = Request::put('http://mockbin.com/request', array('Accept' => 'application/json'), array('name' => 'Mark', 'nick' => 'thefosk'));
     $this->assertEquals(200, $response->code);
     $this->assertEquals('PUT', $response->body->method);
     $this->assertEquals('Mark', $response->body->postData->params->name);
     $this->assertEquals('thefosk', $response->body->postData->params->nick);
 }
开发者ID:RusinovIG,项目名称:unirest-php,代码行数:8,代码来源:RequestTest.php

示例12: updateSubaccount

 /**
  * Update subaccount
  * @param  int             $subaccountId         Required parameter: Example: 
  * @param  string|null     $password             Optional parameter: Example: 
  * @param  string|null     $email                Optional parameter: Example: 
  * @param  string|null     $phoneNumber          Optional parameter: Example: 
  * @param  string|null     $firstName            Optional parameter: Example: 
  * @param  string|null     $lastName             Optional parameter: Example: 
  * @param  bool|null       $accessUsers          Optional parameter: Example: true
  * @param  bool|null       $accessBilling        Optional parameter: Example: true
  * @param  bool|null       $accessReporting      Optional parameter: Example: true
  * @param  bool|null       $accessContacts       Optional parameter: Example: false
  * @param  bool|null       $accessSettings       Optional parameter: Example: true
  * @return string response from the API call*/
 public function updateSubaccount($subaccountId, $password = NULL, $email = NULL, $phoneNumber = NULL, $firstName = NULL, $lastName = NULL, $accessUsers = true, $accessBilling = true, $accessReporting = true, $accessContacts = false, $accessSettings = true)
 {
     //check that all required arguments are provided
     if (!isset($subaccountId)) {
         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 . '/subaccounts/{subaccount_id}';
     //process optional query parameters
     APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array('subaccount_id' => $subaccountId));
     //process optional query parameters
     APIHelper::appendUrlWithQueryParameters($_queryBuilder, array('password' => $password, 'email' => $email, 'phone_number' => $phoneNumber, 'first_name' => $firstName, 'last_name' => $lastName, 'access_users' => null != $accessUsers ? var_export($accessUsers, true) : true, 'access_billing' => null != $accessBilling ? var_export($accessBilling, true) : true, 'access_reporting' => null != $accessReporting ? var_export($accessReporting, true) : true, 'access_contacts' => null != $accessContacts ? var_export($accessContacts, true) : false, 'access_settings' => null != $accessSettings ? var_export($accessSettings, true) : true));
     //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::put($_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,代码行数:71,代码来源:SubaccountController.php

示例13: pathinfo

    if (!$request->param('file') || !$request->param('file_contents')) {
        $response->code(500)->body('Not all required parameters were passed to the script.')->send();
        return;
    }
    $file = (object) pathinfo($request->param('file'));
    if (!in_array($file->extension, $core->files->editable())) {
        $response->code(500)->body("This type of file cannot be edited.")->send();
        return;
    }
    if (in_array($file->dirname, array(".", "./", "/"))) {
        $file->dirname = "";
    } else {
        $file->dirname = trim($file->dirname, '/') . "/";
    }
    try {
        $unirest = Unirest\Request::put("https://" . $core->server->nodeData('fqdn') . ":" . $core->server->nodeData('daemon_listen') . "/server/file/" . rawurlencode($file->dirname . $file->basename), array('X-Access-Token' => $core->server->getData('daemon_secret'), 'X-Access-Server' => $core->server->getData('hash')), array("contents" => $request->param('file_contents')));
        if ($unirest->code === 204) {
            $response->body('<div class="alert alert-success">File has been successfully saved.</div>')->send();
        } else {
            $response->code(500)->body("An error occured while trying to save this file. [" . $unirest->body->message . "]")->send();
        }
    } catch (\Exception $e) {
        \Tracy\Debugger::log($e);
        $response->code(500)->body("An error was encountered when trying to connect to the remote server to save this file.")->send();
    }
});
$klein->respond('POST', '/node/ajax/files/directory', function ($request, $response) use($core) {
    if (!$core->permissions->has('files.view')) {
        $response->code(403);
        $response->body("You are not authorized to perform this action.")->send();
        return;
开发者ID:PhenixH,项目名称:PufferPanel,代码行数:31,代码来源:routes.php

示例14: putInfo

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

示例15: generateServerProperties

 /**
  * Generates a server.properties file from a given template if it does not already exist.
  *
  * @return bool|string
  */
 public function generateServerProperties()
 {
     $response = $this->_getServerProperties();
     if (!$response) {
         \Tracy\Debugger::log($this->node);
         return "Unable to connect to the Surfit Daemon running on the node.";
     }
     if (!in_array($response->code, array(200, 500))) {
         switch ($response->code) {
             case 403:
                 return "Authentication error encountered.";
             default:
                 return "[HTTP/{$response->code}] Invalid response was recieved. ({$response->raw_body})";
         }
     }
     if ($response->code == 500 || !isset($response->body->contents) || empty($response->body->contents)) {
         /*
          * Create server.properties
          */
         if (!file_exists(APP_DIR . 'templates/server.properties.tpl') || empty(file_get_contents(APP_DIR . 'templates/server.properties.tpl'))) {
             return "No Template Avaliable for server.properties";
         }
         try {
             $put = Unirest\Request::put("https://" . $this->node->fqdn . ":" . $this->node->daemon_listen . "/server/file/server.properties", array("X-Access-Token" => $this->server->daemon_secret, "X-Access-Server" => $this->server->hash), array("contents" => sprintf(file_get_contents(APP_DIR . 'templates/server.properties.tpl'), $this->server->server_port, $this->server->server_ip)));
         } catch (\Exception $e) {
             \Tracy\Debugger::log($e);
             return "An error occured when trying to write a server.properties file.";
         }
         if (!empty($put->body)) {
             return "Unable to process request to create server.properties file.";
         }
     }
     return true;
 }
开发者ID:ByteKing,项目名称:Main,代码行数:39,代码来源:daemon.php


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