本文整理匯總了PHP中Buzz\Browser::put方法的典型用法代碼示例。如果您正苦於以下問題:PHP Browser::put方法的具體用法?PHP Browser::put怎麽用?PHP Browser::put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Buzz\Browser
的用法示例。
在下文中一共展示了Browser::put方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setRecord
/**
* This will update all fields of a table record, issuing a PUT request to the record endpoint. Any fields that are not included will be cleared ().
*
* @param string $table
* @param array $criteria
* @param array $fields
*/
public function setRecord($table, array $criteria = [], array $fields)
{
$record = $this->findRecord($table, $criteria);
/** @var Response $response */
$response = $this->browser->put($this->getEndpoint($table, $record->getId()), ["content-type" => "application/json"], json_encode(["fields" => $fields]));
$this->guardResponse($table, $response);
}
示例2: put
/**
* {@inheritdoc}
*/
public function put($url, array $headers = array(), $content = '')
{
$response = $this->browser->put($url, $headers, $content);
if (!$response->isSuccessful()) {
throw $this->handleResponse($response);
}
return $response->getContent();
}
示例3: put
/**
* {@inheritdoc}
*/
public function put($url, $content = '')
{
$headers = [];
if (is_array($content)) {
$content = json_encode($content);
$headers[] = 'Content-Type: application/json';
}
$response = $this->browser->put($url, $headers, $content);
$this->handleResponse($response);
return $response->getContent();
}
示例4: put
/**
* Common put request for all API calls
*
* @param string $resource The path to the resource wanted. For example v2/room
* @param array $content Parameters be putted for example:
* array(
* 'name' => 'Example name',
* 'privacy' => 'private',
* 'is_archived' => 'false',
* 'is_guest_accessible' => 'false',
* 'topic' => 'New topic',
* )
*
* @return array Decoded array containing response
* @throws Exception\RequestException
*/
public function put($resource, $content = array())
{
$url = $this->baseUrl . $resource;
$headers = array('Content-Type' => 'application/json', 'Authorization' => $this->auth->getCredential());
$response = $this->browser->put($url, $headers, json_encode($content));
if ($this->browser->getLastResponse()->getStatusCode() > 299) {
throw new RequestException(json_decode($this->browser->getLastResponse()->getContent(), true));
}
return json_decode($response->getContent(), true);
}
示例5: put
/**
* {@inheritdoc}
*/
public function put($url, $content = '')
{
$response = $this->browser->put($url, [], $content);
$this->handleResponse($response);
return $response->getContent();
}
示例6: send
/**
* @param string $uri
* @param string $data
* @return bool
*/
public function send($uri, $data)
{
$response = $this->browser->put($uri, [], $data);
$statusCode = $response->getStatusCode();
return $statusCode >= 200 && $statusCode < 300;
}