Answer the question
In order to leave comments, you need to log in
Return server response in xml, what to use?
Goodnight.
Tell me how to solve the problem correctly?
There is a table in a DB where the data on flights is stored.
You need to make something like an api for the site.
The user should send a get request to the site in the form of a string like this:
http://example.ru/api/search?from=MOW&to=LED&date1=2012-09-25&date2=2012-10-01&adults=2&children=1&infants=1&cabin=Y&partner=avsl&password=pass
Answer the question
In order to leave comments, you need to log in
you need to understand that RestApi is not just a get request and an xml / json response, it is a specific specification for the Api structure. Ask yourself the question - does your site need to support this specification? if yes - implement RestApi based on Yii tools, if not - work with Response.
You can upgrade to yii 2.0.11. Two methods have been added to the controller: asJson() and asXml(). They serve to return data in JSON and XML format, respectively.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question