getHTTPHeaderValue() (tick_24Validator Engine Only)

array getHTTPHeaderValue(string $fieldname)

Returns, if available, an array of trimmed HTTP header values for all the headers with the name $fieldname, else returns an undefined variable

The header field name is case-insensitive.

This function is supported only in CSE HTML Validator v14.00 and later.

See also: hasHTTPHeader()

Example 1

if hasHTTPHeaders {
 if isSearchEngineEnabled {
  if $robotsarray.isNotEmpty() {
   for ($i=0;$i<$robotsarray.arrayLength();$i++) {
    if $runprogram95result.isNotEmpty() {
     MessageEx(5,2013082803,MSG_WARNING,$SEARCHENGINE,'The "X-Robots-Tag" HTTP header may be incorrect. Details: '+$runprogram95result+'. The full value is "'+$contentvalue+'".');

Example 2

Displays a comment message containing an HTTP header if it exists and is available.

function onEndingValidation() {
 $headername='Content-Length'; // edit for the header you want
 if hasHTTPHeader($headername) {
  MessageEx(13,2016031800,MSG_COMMENT,$headername+': '+$ghhvarray[0]);

Example 3

Display the document byte size as a comment.

function onEndingValidation() {
 MessageEx(13,2016031801,MSG_COMMENT,'Byte size: '+getValueInt(17));