本文整理匯總了PHP中HttpRequest::perform方法的典型用法代碼示例。如果您正苦於以下問題:PHP HttpRequest::perform方法的具體用法?PHP HttpRequest::perform怎麽用?PHP HttpRequest::perform使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類HttpRequest
的用法示例。
在下文中一共展示了HttpRequest::perform方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: update
private function update($object)
{
$attr = $object->getAttributes();
$data = $this->encodeResponse($attr);
$url = $this->getMethodUrl(array('id' => $object->id));
$req = new HttpRequest();
$req->setUrl($url);
$req->setParam('data', $data);
$req->setMethod('POST');
$response = $req->perform();
$result = $this->decodeResponse($response);
return $this->validateResponse($result);
}
示例2: findWithOptions
public function findWithOptions($options)
{
$req = new HttpRequest();
$url = $this->getMethodUrl($options);
$req->setUrl($url);
$req->setParams($options);
$response = $req->perform();
$result = $this->decodeResponse($response);
if (isset($result['error'])) {
throw new RemoteException($result['error']);
}
return $this->createResultDataSet($result);
}
示例3: removeUser
public function removeUser($id)
{
$url = $this->makeServiceURL(self::API_USER_BASE_URL, '/user/' . $id);
$req = new HttpRequest();
$req->setUrl($url);
$req->setMethod('DELETE');
return $req->perform();
}