本文整理汇总了PHP中HttpSocket::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpSocket::delete方法的具体用法?PHP HttpSocket::delete怎么用?PHP HttpSocket::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpSocket
的用法示例。
在下文中一共展示了HttpSocket::delete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: request_delete
public function request_delete($id)
{
$link = Router::url('/', true) . 'rest_posts/' . $id . '.json';
$data = null;
$httpSocket = new HttpSocket();
$response = $httpSocket->delete($link, $data);
$this->set('response_code', $response->code);
$this->set('response_body', $response->body);
$this->render('/Client/request_response');
}
示例2: request_delete
public function request_delete($id)
{
// remotely post the information to the server
$link = "http://" . $_SERVER['HTTP_HOST'] . $this->webroot . 'rest_tasks/' . $id . '.json';
$data = null;
$httpSocket = new HttpSocket();
$response = $httpSocket->delete($link, $data);
$this->set('response_code', $response->code);
$this->set('response_body', $response->body);
$this->render('/Client/request_response');
}
示例3: sendRequest
/**
* HTTP上で要求の送信
* @param string $url
* @param array $data
* @param string $type
*/
private function sendRequest($url, $data, $type = 'post')
{
$http = new HttpSocket();
if ($type == 'post') {
$response = $http->post($url, $data);
} else {
if ($type == 'get') {
$response = $http->get($url, $data);
} elseif ($type == 'delete') {
$response = $http->delete($url, $data);
}
}
return json_decode($response->body);
}
示例4: delete
public function delete($id)
{
// remotely post the information to the server
$link = "http://" . $_SERVER['HTTP_HOST'] . $this->webroot . 'posts/' . $id . '.json';
$data = null;
$httpSocket = new HttpSocket();
// $data['Post']['title']="this is updated title";
//$data['Post']['content']="this is updated content";
$response = $httpSocket->delete($link, $data);
$this->set('response_code', $response->code);
$this->set('response_body', $response->body);
$this->set('link', $link);
$this->render('/client/request_response');
}
示例5: deleteEventFromServer
/**
* Deletes the event and the associated Attributes from another Server
* TODO move this to a component
*
* @return bool true if success, error message if failed
*/
public function deleteEventFromServer($uuid, $server, $HttpSocket = null)
{
// TODO private and delete(?)
$url = $server['Server']['url'];
$authkey = $server['Server']['authkey'];
if (null == $HttpSocket) {
App::uses('HttpSocket', 'Network/Http');
$HttpSocket = new HttpSocket();
}
$request = array('header' => array('Authorization' => $authkey, 'Accept' => 'application/xml', 'Content-Type' => 'application/xml'));
$uri = $url . '/events/0?uuid=' . $uuid;
// LATER validate HTTPS SSL certificate
$this->Dns = ClassRegistry::init('Dns');
if ($this->Dns->testipaddress(parse_url($uri, PHP_URL_HOST))) {
// TODO NETWORK for now do not know how to catch the following..
// TODO NETWORK No route to host
$response = $HttpSocket->delete($uri, array(), $request);
// TODO REST, DELETE, some responce needed
}
}
示例6: delete
/**
* Make a delete request to the api
* @param string $url relative to the base
* @param array $data
* @return array
*/
public function delete($url, $data = array())
{
$http = new HttpSocket();
return $this->process($http->delete($this->apiBase . $url . '?' . http_build_query($this->_params($data))));
}