Zend_Http_Client and Case Sensitivity

Recently I posted about Zend_Http_Client and the ability to check a request HEAD or GET. It is, as everything in Zend Framework, extremely easy to adopt and use, but today I experienced some “strnage” problems!

As I wrote some lines of code,

<?php
....
$client = new Zend_Http_Client('uri_path');
$request = $client->request('head');
...
?>

so far so good, everything worked just perfect until I deployed the “working” code on the production server. Than odd enough some requests just crashed. Not all – just some of them.

Another strange thing was that no exception was thrown.

Maybe using more my intuition instead of my brain I just tried to request the head using capital letter – HEAD. And as everything was strange enough, yet again this solution happened to be working! That solved my problem.

<?php
....
$client = new Zend_Http_Client('uri_path');
$request = $client->request('HEAD');
...
?>

3 thoughts on “Zend_Http_Client and Case Sensitivity

  1. Try to use the constants provided by Zend_Http_Client, e.g. Zend_Http_Client::HEAD.
    You don’t need to worry when using them. 🙂

  2. Indeed the correct code is:

    $response = $httpClient->request(Zend_Http_Client::HEAD);

    Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *