Search code examples
phpjqueryjsongetjsonphpquery

phpquery getJson and Zend Json issue


I am forced to use phpquery::getJson for architecture reason and because the Curl php extension give me some problem ( probably I am not able to set it up correctly ).

I wish to use a directly getJson ( I know that I can use also a phpQuery::ajax function and after parse the result manually ) so if anyone less expert than me can use this solution too.

Hello I am trying use this:

phpQuery::getjson($url)

or the other version:

 phpQuery::ajax(array(
  'type' => 'GET',
  'url' => $url,
  'data' => array('prova'=>'ciao'),
  'success' => getJsCallback($doc),
  'dataType' => 'json',
  ));

But it says :

Warning: require_once(Zend/Json.php): failed to open stream: 
No such file or directory in /home/giuseppe/homeProj/phpQuery/phpQuery/phpQuery/Zend/Json/Decoder.php

So I added manually from ZendFramework : Zend/Json.php Zend/Json/Expr.php

And it gives me :

 Fatal error: Uncaught exception 'Zend_Json_Exception' with message 'Illegal Token'

If anyone has the solution and would like to share, he's welcome Thanks


Solution

  • Thanks to bluelover to reply from github you should add zendframework to your include path.

    So downlowad the 1.1 version of zend framework, put it inside a folder reachable by apach ( f.e. /var/www/Zf1_1/ ) and then set the ZF frameowkr inside the include path this way:

    //replace /var/www/Zf1_1/library with your actualy ZF library path
    set_include_path(get_include_path() . PATH_SEPARATOR . '/home/giuseppe/homeProj/ZendFramework1/ZendFramework-1.11.11/library/');
    

    if it gives you problem with permission denied don't forget to put when it's in use from unix terminal

    $ chown www-data -R /var/www/Zf1_1/library