public function EasyRdf_Http_Client::setHeaders

Set a request header

Parameters

string $name Header name (e.g. 'Accept'):

string $value Header value or null:

Return value

EasyRdf_Http_Client

1 call to EasyRdf_Http_Client::setHeaders()
EasyRdf_Http_Client::request in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Http/Client.php
Send the HTTP request and return an HTTP response object

File

drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Http/Client.php, line 184

Class

EasyRdf_Http_Client
This class is an implemetation of an HTTP client in PHP. It supports basic HTTP 1.0 and 1.1 requests. For a more complete implementation try Zend_Http_Client.

Code

public function setHeaders($name, $value = null) {
  $normalizedName = strtolower($name);

  // If $value is null or false, unset the header
  if ($value === null || $value === false) {
    unset($this->headers[$normalizedName]);
  }
  else {

    // Else, set the header
    $this->headers[$normalizedName] = array(
      $name,
      $value,
    );
  }
  return $this;
}