X
X
XenK2016-01-23 12:20:13
PHP
XenK, 2016-01-23 12:20:13

PHP parsing problem?

Actually, there is a code of this kind, as a result of which I get the basic information and display it in a table:

$data = json_decode(file_get_contents('http://test.ru/api'), 1);
     foreach ($data['response'] as $d) {
             // Тут идет вывод данных в таблицу
      }

But in test.ru/api there is a link like: test.ru/api?info , which contains more detailed information that must also be displayed in a table.
The question arose, how to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivanq, 2016-01-23
@Ivanq

$data = json_decode(file_get_contents('http://test.ru/api'), 1)['response'];
$data2 = json_decode(file_get_contents('http://test.ru/api?info'), 1)['response'];
$data = array_merge($data, $data2);
foreach ($data as $d) {
 // Здесь данные из api?info и api.
}

(PHP) array_merge

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question