0

I've one website built in PHPFox. The website is functioning properly. Now the mobile apps for iPhone and Android smartphone are under development which will use the same database that PHPFox website is using.

So, I want to make the existing APIs that are used for a PHPFox website available to the mobile apps (both iPhone and Android) as well. I don't want to reinvent the wheel again and want to re-use the same existing code for mobile apps.

I did a lot of research about this. I've spent almost four days on the research. I didn't get a single link which will explain me how to access the existing APIs from a PHPFox website for mobile apps (iPhone and Android).

One option I found from my research is creating new RESTful webservices using PHP or implement any such framework like Slim, apigility, etc.

But I think following any of the above two approaches will be a overhead and re-usability of code will also not be achieved. If the code which is working fine for website should also be used used on mobile apps. There should be no need to write the same code again. That's what I think.

So using the existing APIs from PHPFox website is the best solution that I think, might be I'm wrong. If you think I'm wrong please correct my approach.

If you could explain with some useful example it would be really great.

I've gone through PHPFox docs as well but couldn't get anything useful which could help me in the issue I'm facing. If you are also interested in documentation of PHPFox please go to below links:

  1. http://unity.moxi9.com/docs
  2. http://unity.moxi9.com/kb

If you could find anything useful related to the issue I'm facing please do let me know.

PHPLover
  • 1
  • 51
  • 158
  • 311
  • Does PHPFox offer an API system to access the backend, or can you build one with that framework? You can use Slim (or indeed any general-purpose framework) but it makes sense to use the application architecture you have if possible. Does PHPFox have online docs that might show whether it has this? – halfer Jan 18 '15 at 14:06
  • @halfer:Yes, PHPFox offer an API system indeed but nowhere the information is available on the internet how to access this PHPFox API system on mobile apps. That's the biggest issue I'm facing right now. Also the doce for PHPFox are also not that much informatory and useful. Using framework like Slim or any other such framework will be a very long way I think. If you could suggest a way to access existing PHPFox API system for mobile apps it would be really great. Thanks for showing interest in my issue. – PHPLover Jan 18 '15 at 14:10
  • You could always supply a link to the docs you are reading, in case someone here wishes to browse them. If you think PHPFox won't work, Slim is excellent, the docs are thorough, and it will take you a very short time to get started. There is barely any learning overhead to this framework. – halfer Jan 18 '15 at 14:12
  • 1
    @halfer:Following are the two links for PHPFox documentation :http://unity.moxi9.com/docs and http://unity.moxi9.com/kb. I've gone through them but nothing useful I found regarding my issue. If you get something useful please do let me know or rather you could post it as an answer. – PHPLover Jan 18 '15 at 14:15
  • It looks like there's _loads_ of API information there. Perhaps you are just not using the right search terms? Search for "Android call API library" or similar to find out how to call an API from Android, then do the same for iOS. The actual format of calls is on the PHPFox site, but that seems not to be the problem. – halfer Jan 18 '15 at 20:38
  • Now, the above suggestion assumes you don't need any site-wide secret keys to access the PHPFox API. If you do, then you should not make the API calls directly from the mobile device, since each device would need a copy of your secret key (and it would no longer be secret). If this is the case then you will need to make an API on your PHP server, and proxy the call to PHPFox yourself. You can then just use a per-user username/password. – halfer Jan 18 '15 at 20:40
  • @halfer:As you suggested I searched on PHPFox site by using strings like "Android call API library" and "iOS call API library" but I got 0 matching results for it. Now coming to your second comment here you got my exact issue. I want to generate a secret key when I call the PHPFox API from mobile app. Upon each request this security token(i.e. security key) needs to be checked before accessing the requested service. I didn't get any information about how should I access the APIs from existing PHPFox website. If you could explain with some good example it will be really very helpful. Thanks. – PHPLover Jan 19 '15 at 04:24
  • No, use those search phrases in a search engine. As for secret keys, if they are site-wide (i.e. same secret for all callers, must remain secret) then you will need to proxy your API calls from mobile to your server to the PHPFox server (so the secret key is not distributed inside your mobile app). If they are per user, you can go direct from mobile to PHPFox server if you wish (though you will get more control if you proxy). – halfer Jan 19 '15 at 12:07
  • Ultimately, your question is "how do I write an API client" and "how do I write an API server", which is far too broad. I would have to write a whole book in the space below! Find a tutorial or a book that shows you how to build these in general, and then you'll understand how to do this for your particular case. – halfer Jan 19 '15 at 12:09
  • I have the same issue I am also not getting any way to create web services in phpfox, I have search a lot but did not find any clue to do this. – Anshul Mishra Sep 02 '15 at 10:37

1 Answers1

0

Well everything you are looking for is already there in the docs. Your mobile app would be registered as an app with PHPFox. You can then use their API. The remaining question is, if the end users need to authorize your mobile app from their "normal" web browser or if this authorization can be performed from the mobile app as well. At least that's what I read from the docs. Since you have an up and running installation at your hand: Just try it! Register an app and perform some requests to their API.

Markus Müller
  • 2,611
  • 1
  • 17
  • 25