Nothing ![]()
stdClass Object ( [http_code] => 400 [apiresult] => )
private function _putRequest($reqString, $paramArray, $apiUser = 'system')
{
return $this->_putpostRequest($reqString, $paramArray, $apiUser, true);
}
private function _putpostRequest($reqString, $paramArray, $apiUser = 'system', $putMethod = false)
{
$ch = curl_init();
$url = sprintf(
'%s://%s%s?api_key=%s&api_username=%s',
$this->_protocol,
$this->_dcHostname,
$reqString,
$this->_apiKey,
$apiUser
);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($paramArray));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if ($putMethod) {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
}
$body = curl_exec($ch);
$rc = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$resObj = new \stdClass();
$resObj->http_code = $rc;
$resObj->apiresult = json_decode($body);
return $resObj;
}