function cf_http_validate_response in Common Functionality 7.2
Same name and namespace in other branches
- 7 modules/cf_http/cf_http.module \cf_http_validate_response()
Validate http responses by checking header.
Originally From: http://php.net/manual/en/function.fsockopen.php#85572
@see: cf_http_get_webpage()
Parameters
array $headers: An array of http headers to validate.
Return value
bool A boolean with TRUE representing that the headers are valid, FALSE otherwise.
Related topics
1 call to cf_http_validate_response()
- cf_http_parse_response in modules/
cf_http/ cf_http.module - Accepts and processes provided http content.
File
- modules/
cf_http/ cf_http.module, line 143 - Common Functionality - HTTP module.
Code
function cf_http_validate_response(array $headers) {
if (empty($headers)) {
return FALSE;
}
switch (trim(strtolower($headers[0]))) {
case 'http/1.0 100 ok':
case 'http/1.0 200 ok':
case 'http/1.1 100 ok':
case 'http/1.1 200 ok':
return TRUE;
}
return FALSE;
}