views:

24

answers:

1

Hi,

I am trying to use Zend_Http_Client to fetch a specific page (www . nu . nl) I am using this code

$client = new Zend_Http_Client($url,
    array(
        'maxredirects' => 5, 
        'timeout' => 30,
        'useragent' => 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.3) Gecko/20010801 '
    )
);
$code = $client->request("GET");
$pageBody = $code->getBody();

For this specific site, $pagebody is empty (0). Using xdebug, it seems that it fetches the encoded response but fails on the decoding. Also, and this is wierd to me, sometimes it works with no problem!

I would appreciate any thoughts on how to solve this.

Thank you.

A: 

Sorry but I am not able to reproduce your problem.

$url = 'http://www.nu.nl';
$client = new Zend_Http_Client($url, array(
    'maxredirects' => 5,
    'timeout' => 30,
    'useragent' => 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.3) Gecko/20010801 '
));

$response = $client->request("GET");
$pageBody = $response->getBody();
var_dump(strlen($pageBody));

Output: int(36902)

Benjamin Cremer
Yes, I can't reproduce it at this time as well. I notice they use " Juniper Networks NitroCache/v1.0" so it is possible that there was a glitch on the server side and not on the framework. I will be monitoring it for the next days. Stupidly enough, I did not record the unencoded data on the first day I noticed the problems.
john
I actually reproduced it after all and submited it as a possible bug:http://framework.zend.com/issues/browse/ZF-10179?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel
john