Title: Requests_Response_Headers::offsetGet
Published: August 16, 2016
Last modified: November 2, 2022

---

# Requests_Response_Headers::offsetGet( string $key ): string|null

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/requests_response_headers/offsetget/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/requests_response_headers/offsetget/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/requests_response_headers/offsetget/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/requests_response_headers/offsetget/?output_format=md#source)

[ Back to top](https://developer.wordpress.org/reference/classes/requests_response_headers/offsetget/?output_format=md#wp--skip-link--target)

Get the given header

## 󠀁[Description](https://developer.wordpress.org/reference/classes/requests_response_headers/offsetget/?output_format=md#description)󠁿

Unlike [Requests_Response_Headers::getValues()](https://developer.wordpress.org/reference/classes/requests_response_headers/getValues/),
this returns a string. If there are multiple values, it concatenates them with a
comma as per RFC2616.

Avoid using this where commas may be used unquoted in values, such as Set-Cookie
headers.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/requests_response_headers/offsetget/?output_format=md#parameters)󠁿

 `$key`stringrequired

## 󠀁[Return](https://developer.wordpress.org/reference/classes/requests_response_headers/offsetget/?output_format=md#return)󠁿

 string|null Header value

## 󠀁[Source](https://developer.wordpress.org/reference/classes/requests_response_headers/offsetget/?output_format=md#source)󠁿

[View all references](https://developer.wordpress.org/reference/files/wp-includes/requests/response/headers.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/Requests/Response/Headers.php#L26)

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Frequests_response_headers%2Foffsetget%2F)
before being able to contribute a note or feedback.