Venkat Papana
Venkat Papana

Reputation: 4927

Best way to call Rest API presented on the same server

I have a JSON based REST API implemented using PHP that will be called from my mobile app. I have a website deployed on the same server where the REST API existed. What is the best way to use the existing functionality, is it by sending a cURL request to my API or just by including actual model classes source code and calling those functions?

Upvotes: 2

Views: 1605

Answers (1)

Andrew Drake
Andrew Drake

Reputation: 21

If they're logically part of the same application, you might consider implementing the functionality of the REST API as a helper function. Then, you can include that function (and whatever model classes it needs) and get the code re-use without the overhead of creating another request.

Upvotes: 2

Related Questions