@
@
@Pdfer2015-12-25 11:28:53
PHP
@Pdfer, 2015-12-25 11:28:53

API usage?

Good afternoon.
Perhaps the question will seem silly to you, but still)
How can I use api from the same Yandex in a php script?
Let's say I received a response in the form of JSON or XML. How can I pass this response to a variable that I will use on the site?
The only way I can imagine is CURL.
But it seems very bulky to me. And maybe not serious.
Perhaps there is a "more correct" way to use the API?
Thank you for your attention!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Adamos, 2015-12-25
@Adamos

Let's say I received a response in the form of JSON or XML. How can I pass this response to a variable that I will use on the site?

Parse this answer, respectively, json_decode or simpleXML - and use.
Not inventing problems that don't exist.
By the way, CURL may not be needed to get this data - file_get_contents will also work at the direct address.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question