magicmoleuk Posted July 1, 2012 Share Posted July 1, 2012 Hi I'm trying to get a result set from Amazon using Zend_Service_Amazon public function importerAction() { $amazonPublicKey = Zend_Registry::get('config') ->amazon->product_advertising->public->key; $amazonPrivateKey = Zend_Registry::get('config') ->amazon->product_advertising->private->key; $amazonCountry = Zend_Registry::get('config')->amazon->product_advertising->country; $amazon = new Zend_Service_Amazon_Query($amazonPublicKey, $amazonCountry, $amazonPrivateKey, 'myassociatetag'); $amazon ->category('Books') ->AssociateTag('httpwwwlogicf-21') ->Keywords('PHP'); $results = $amazon->search(); print_r ($results); } print_r ($result) returns this Zend_Service_Amazon_ResultSet Object ( [_results:protected] => DOMNodeList Object ( ) [_dom:protected] => DOMDocument Object ( ) [_xpath:protected] => DOMXPath Object ( ) [_currentIndex:protected] => 0 ) I am running Zend 1.11.12. I have updated the file Amazon.php to handle the new Associate Tag requirement that was recently introduced http://framework.zend.com/issues/browse/ZF-12046. (I updated contstructor and _prepareOptions method in the class as this doesn't appear to have been done in the release). When I run a debug session, if I inspect $result and look at the headers, I see this:- Date: "Sun, 01 Jul 2012 09:09:39 GMT" Server: "Server" Content-Type "text/xml;charset=UTF-8" Vary: "Accept-Encoding,User-Agent" Content-encoding: "gzip" Connection: "close" Transfer-encoding: "chunked" Body: "514\r\n\x1F?\x8\x0\x0\x0\x0\x0\x0\x3?Wio?8\x10?+D??\x1T?\$?G??\n?h??rm']?KAS??\$?\x14e???;?dINS??\x8??a?C??f4?r^?\x1Z0?p\x11?v????^?N_?p???!Kb\x11%\xC??(????\xF0^?I???S?4HH?E? \"????\x8C&)\x1B???6-?0??i???U?\$Q?k?>?,Q?s:\x1E\xFN\x19?!\x4?d\xBtIB??\x6\xF?Ej\x7? \x5?G\x16??N!?OG\x1?\x7??s\x15??\x1B*??}wB???\xC?2;??\x18]??5(kw?f??;\x13??????Y\x1A???Z\x16\x1???\x1U8?P??P, (?\x1E?i?>??(@???U?????????????ÿ??v?<?\$I\x18?& 8?\x1???????o??q{*|\x16\x11??*\x19:T????}?g?E'???\x1F??%[]z?g\"8??X?????????????J?V\x11?B\x12\x4??I\x12A9QlLf?????r\x19?\x19?Sö??>????gw??C!n??Z7?SS?j???A\r?B?I?78\x1Dl*?Z\xB\x16?9?B?G3]C?l???i???S????\xE????][??}\x2?p?\x1D?9x??\x18\x2??u?.???r?l???J?\x3?\xB?\x1A?n\x6???\"p???\\??B?\x0,?\x1 bw?}\x7o??\xB\x32c??*N??s!\$+??~-\x3w=??j?5?[<??d>????\\??k\n\xFL?6??o???J\x6h.X?;?L\x14\x8?\x1??&w???\x6?\xF\r?h\x16?O?\x5??|s[???<\x68w?v*\x3X??\x6?\$?v?y<?`\x19??\x13?\x6+???#???]hg\x2Ef??m?\x1D??IB%?u?}????p??\x18e=\x0\x1D<?_?fk?m?:Vs\xF\x1AT\xB?c?\x8?0?\x1E?\x15?s0\x1AA???j???xG\x16d?Ec?\x14??\x1F??2\xF?lF\xC <\x163 \x6)??ä?`\r\xE?\x2< ?E??.??\x15E\x4??n?5??\r??t7\x13?@9\x7\x7I??`?\x11???@\x1Fx2\xFx??????\x6V?|3?+?,?1?}????\x1D\x1\x1D\x2??07b???'f???C?\x1?+x\x1E\x7j?\x0y??\x46??\x6S\xC=??????sa?\x1\x4Gi?\x4?\x1D@C??l?<\x1\n?i?X\n?????j:\x5n}Z?\x8?c??\x5f??\x4\x3~0N<?\$??J\x13??????PLx?.???`??2??D??P?_L?W?\xF\x19\xF?\x15?\x0?\"0???? o???5?:xC?\n????\x8??\x15???+D\"\x1FU3?\x0??llOV??FoS?3?\x4:?2\x6??UDBN?\x7xE??\x5e?????9??9?i[????i>?c ??^\n?\x6x7F?}?-??\x17?-?4_,?T??\x8n?A????G??sa????+??\xC?????????H?B?A\x10????\x11:??B\x3\to??H.0?3.??4?\nY'\n???\x3tÓ?\x4?}??-\x18)???G??Ob??\xE?/w??4f)X?-X b?Nn@\x13\x19C\x6\r?\"??4\xCy?2??\x17?2??_,?T??\x8??A??X?G??b?/\x0\x0\x0??\r\n21d\r\n?]K?0\x18???{?\t\x6?Lz???\t:?:??\x6???H??7i?-\"?:c??]l,??p\x1E?{??2? ?\x5?tG?-(sA8????\$tC???V??\x11\x18??\\??:?????7\x4]?O\\Z?~B1??(?v0??dx?(?g\x1C????\x5?9\x0g\nh%\xB?\x6\x1E<?Apo=???u'??c?\x1Cx*?\\\t<Z?F\x3O+??\x6?\x3O???\x13x:\"?c?gd?\x4?\x10zp0?<<??\x1D+\x1B?\x19?N?\x1BKP?X\x12??????45??.75?f?45Z?F??V??-\r?75???NS?\x11\x19??Ka?PXeSM\r?ZH??}<\xC<??e\x1CN?WW?M????8?o\x1E?TB??D?wt.OV b??#?0N?,\"6?9?\x8C??\x10?????eD??\x1C\x16\x10?\x1D\x19?@?-\x4y?9??\tg?P??S?e???t?\x18?J{??\x8&w??\x10???{Y\x15- o?zP+h??#\x8\x6??\x18k??L?<C?\$??????c1Ea??\x1BF????\x18jm6q\x3*??]????\xBP1%k\xC*??\x1B[\x1A??^??w?tH?- r)\r\x14\x1E\x8O?/?_?rr}\x13F?\x1F?Y?[\x1F???b??-\x1B?D\x2?mC??m?y??\x18??r??W\x11??C,?\x1F???\x5\x0\x0??\r\n158\r\n?\\=\xB?0\x14?+\x19?\x10ZA?I????\"???\xF?-?u??4?\rt?j???uJ??p???Ksm??ZDt\x1A?\x1F\x19^??\xB?G\x12????%????+?\\?\x3(???\x6\x1D@???\t +??\x6??87?0h!??:\x1C?\x2?n??@^\x4a\"?0k.???/!C%?#????+W?}a?\xCG????0??y\x13\x17?\x1E?d?=?K?);U&?X\x19?I\"+?m?\x14??1I\$d?M?\xE?)\xC?0I\x1C?ÔI?\x4\xCM?Y\n?D?-kR??G A\x11?YZ?m(?<?\x1C?I?`?U??H\x1E\x15???ue\x12\x4\x3??l\x17???\xC?kLn?\n?\x13?R?\x0C_????\x19\x4}?!??/??\x1BS\x18?????w}q\x8\x6???T?U???\$?\$sK??}s???\x19??\x13,?']N?c?E\x0\x0\r\n0\r\n\r\n" The http response code is 200. It looks like to me as though the body is gzip encoded. I thought Zend was supposed to handle that and decode on the fly? If I run this $test = $response->decodeGzip($body) I get 'false' returned. I have enabled this in php.ini zlib.output_compression = On Also, I have enabled this in httpd.conf LoadModule deflate_module modules/mod_deflate.so Any ideas on how to proceed are gratefully appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/265070-zend-frame-work-zend_service_amazon-gzip-body/ Share on other sites More sharing options...
magicmoleuk Posted July 1, 2012 Author Share Posted July 1, 2012 I managed to get this work using a different method $amazon = new Zend_Service_Amazon_Query($amazonPublicKey, $amazonCountry, $amazonPrivateKey, $amazonAssociateTag); Quote Link to comment https://forums.phpfreaks.com/topic/265070-zend-frame-work-zend_service_amazon-gzip-body/#findComment-1358345 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.