Json/Rest api problems...

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

mark377
Posts: 8
Joined: Fri Nov 12, 2010 4:41 pm

Json/Rest api problems...

Post by mark377 »

Hi

I am trying to create a flash application that sends a http get request to retrieve information from the faq database. However, i need to be able to get back the faq information in some readable and structured way such as json, etc..

You mention in your documentation that you have a json api to do just this. However, i am unable to get this to work.

when i submit the following (example) using my own page instead of mysite.com, i get no json encoded array back. I am searching by keyword, which brings up a result in the main system, but not using this.

what am i doing wrong?

http://www.mysite.com/phpmyfaq/api.php? ... en&q=hello

thanks
Thorsten
Posts: 15815
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Json/Rest api problems...

Post by Thorsten »

Hi,

the call looks okay. You can also test it on our own FAQ:

http://faq.phpmyfaq.de/api.php?action=s ... =framework

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
mark377
Posts: 8
Joined: Fri Nov 12, 2010 4:41 pm

Re: Json/Rest api problems...

Post by mark377 »

Hi

Maybe I am not asking the right question, actually what i want to know is how you normally would make such a call using javascript, PHP, etc. How do I get back the question and answer on the screen. What is the easiest way to do that?

Kind Regards
Thorsten
Posts: 15815
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Json/Rest api problems...

Post by Thorsten »

Hi,

ah, okay... this is just a GET request over HTTP... you can do that e.g. with curl, PHP, JavaScript...

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
mark377
Posts: 8
Joined: Fri Nov 12, 2010 4:41 pm

Re: Json/Rest api problems...

Post by mark377 »

if its just a get request - then this should output some information, right? but it does not:

see my page below:

http://www.carlinginsight.com/phpmyfaq/ ... en&q=works

when i do a get request to your page you provided I receive some information. With mine however, I get nothing.


thanks
Thorsten
Posts: 15815
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Json/Rest api problems...

Post by Thorsten »

Hi,

a white page is normally a PHP fatal error. Do you have access to your server logs?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
mark377
Posts: 8
Joined: Fri Nov 12, 2010 4:41 pm

Re: Json/Rest api problems...

Post by mark377 »

Hi

I currently have error reporting set to E_ALL and Display Errors On in my php.ini.

Other scripts display errors if they have them, but api.php does not.

I am not seeing any error related to this in my server event log.


Kind Regards
Thorsten
Posts: 15815
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Json/Rest api problems...

Post by Thorsten »

Hi,

please try to enable the debug output in inc/Init.php as well.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
mark377
Posts: 8
Joined: Fri Nov 12, 2010 4:41 pm

Re: Json/Rest api problems...

Post by mark377 »

Hi

I have enabled the debug in Init.php as well, and now I see debug ouput when i am in admin system and front end. However still nothing from the api.php page.

http://www.carlinginsight.com/phpmyfaq/


Kind Regards
Thorsten
Posts: 15815
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Json/Rest api problems...

Post by Thorsten »

Hi,

something is broken with your installation because even the version request returns a white page:

http://www.carlinginsight.com/phpmyfaq/ ... getVersion

For further investigations I would need access to your server.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
mark377
Posts: 8
Joined: Fri Nov 12, 2010 4:41 pm

Re: Json/Rest api problems...

Post by mark377 »

Sure, I have sent you a PM about it.

Kind Regards

Mark
mark377
Posts: 8
Joined: Fri Nov 12, 2010 4:41 pm

Re: Json/Rest api problems...

Post by mark377 »

Hmm, I tried to re-install with slightly different settings, this time i selected to use mysql instead of mysqli, installed to mysql database with utf-8-bin encoding, and i'm afraid there is still a problem. There were no errors or problems mentioned by the install script during or after the installation.

I am not sure where to look for the problem. If you can, have a look to see if you find the problem - i have sent you my server details. I am sure i will not be the only person having this problem when installing on iis/windows.

Kind Regards

Mark
Thorsten
Posts: 15815
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Json/Rest api problems...

Post by Thorsten »

Hi,

I'll try to check it this evening.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Thorsten
Posts: 15815
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Json/Rest api problems...

Post by Thorsten »

Hi,

I just found it: https://github.com/thorsten/phpMyFAQ/co ... 1d675d4585

Please use this patch and it will work.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
mark377
Posts: 8
Joined: Fri Nov 12, 2010 4:41 pm

Re: Json/Rest api problems...

Post by mark377 »

Thanks,

this has fixed my problem, i am getting a json response back!

thank you for resolving this issue so quickly,

Kind Regards

Mark
Post Reply