Answer the question
In order to leave comments, you need to log in
How to implement getting data from API via PHP interface?
It is necessary to implement the API of a third-party service into the project. In the future, this service may be replaced or a local implementation will be used. Do I understand correctly that in this case it is necessary to use an interface in order to be able to replace the implementation in the future?
Let's say an array of data is returned from the service, what is the most correct way to implement getting data through the interface, how to create getter methods for each of the array elements, for example getRegionFiasId() ?
Answer the question
In order to leave comments, you need to log in
API server connection:
php.net/manual/ru/book.curl.php
php.net/manual/ru/curl.examples-basic.php
JSON processing:
php.net/manual/en/book.json.php
php .net/manual/en/function.json-decode.php
XML parsing:
php.net/manual/en/book.xml.php
php.net/manual/ru/function.xml-parse.php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question