S
S
SteepNET2021-10-06 16:57:23
PHP
SteepNET, 2021-10-06 16:57:23

json_encode and file_get_contents php?

The question seems to be not difficult, I couldn’t find an example, help me figure it out, this script is on one server, I need to pick up json from another server, I see it through file_get_contents() , tell me in what form the file should be and how it is composed in that kind of accept it in your script?

$str = '{
"names":[
{"phrase": "Anga","name": "Angela"},
{"phrase": "Measure","name": "Merkel"},
{"phrase" : "Fufa","name": "Fufelina"},
{"phrase": "Tata","name": "Tatalina"},
{"phrase": "Zhenya","name": "Eugene"}
]
}';

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Prokhorov, 2021-10-06
@kotcich

json_decode(file_get_contents('path'), true);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question