Zend Feed how to get ETag from Header


#1

Hi Guys, I am using Zend-Feed everything works perfectly fine.

$feed = Reader::import($url);

Now i got the feed, i am just not sure how to get the ETag and Last-Modified from it now, there is ‘getHeaderLine’ function but it just dont work on $feed->getHeaderLine(‘ETag’). because above import function returns $reader = static::importString($response->getBody());

Any idea how i get the header details?


#2

That’s right, the feed reader does not have this method. Use the HTTP client:

$client = Zend\Feed\Reader\Reader::getHttpClient();
/** @var Zend\Feed\Reader\Http\Response $response */
$response = $client->get(
    'https://github.com/zendframework/zend-feed/releases.atom'
);
$header   = $response->getHeaderLine('ETag');

#3

Thank you @froschdesign