How to call directly a function php using Retrofit android

Viewed 330

I have used retrofit to communicate my App with the php server. But I want call directly a function PHP OO.

This is my class PHP:

class Car extends Obj {

   public function __construct($name, $pathImg) {
       parent::__construct($name, $pathImg);
   }

   function get() {
       $engine = new Engine(55, 2016, '5.0');
       $brand = new Brand('MY BRAND', null);
       $car = new Car('MY CAR', null, $brand, $engine);

       header('Content-Type: application/json; charset=utf-8');
       echo json_encode(array('car' => $car));
   }
}

My retrofit API in app:

@FormUrlEncoded
    @POST("package/ctrl/Car/")
    Call<Car> get(@Field("id") int id);

Is it possible to call directly a function with retrofit? Or use another API to do it?

1 Answers
Related