You are here

public function TwitterOAuth::get_headers_from_curl_response in Tweet Feed 7.3

1 call to TwitterOAuth::get_headers_from_curl_response()
TwitterOAuth::http in inc/twitter-oauth.inc
Make an HTTP request

File

inc/twitter-oauth.inc, line 233

Class

TwitterOAuth
Twitter OAuth class

Code

public function get_headers_from_curl_response($response) {
  $headers = array();
  $header_text = substr($response, 0, strpos($response, "\r\n\r\n"));
  foreach (explode("\r\n", $header_text) as $i => $line) {
    if ($i === 0) {
      $headers['http_code'] = $line;
    }
    else {
      list($key, $value) = explode(': ', $line);
      $headers[$key] = $value;
    }
  }
  return $headers;
}