function restclient_response_code in RESTClient 7.2
Analyze the response code from a request
Parameters
object $response [reference]: Response object
Return value
string Returns the class of response code, FALSE otherwise.
3 calls to restclient_response_code()
- restclient.wsconnector.inc in ./
restclient.wsconnector.inc - _restclient_request in ./
restclient.module - Basic request with no body data.
- _restclient_request_with_body in ./
restclient.module - Requests with body data.
File
- ./
restclient.module, line 72 - Defines a standard REST interface to RESTful services
Code
function restclient_response_code(&$response) {
// Classify the response code
if (isset($response->code)) {
if (intval($response->code) >= 100) {
switch (intval(floor(intval($response->code) / 100))) {
case 1:
return RESTCLIENT_RESPONSE_INFORMATIONAL;
case 2:
return RESTCLIENT_RESPONSE_SUCCESS;
case 3:
return RESTCLIENT_RESPONSE_REDIRECTION;
case 4:
return RESTCLIENT_RESPONSE_CLIENT_ERROR;
case 5:
return RESTCLIENT_RESPONSE_SERVER_ERROR;
default:
return FALSE;
}
}
}
return FALSE;
}