H
H
hawxalex2019-12-28 13:15:48
PHP
hawxalex, 2019-12-28 13:15:48

json parser by link with data entry in mysql?

Good day, I'm trying to parse Json data from a url, I
wrote a small fragment of json_decode

<?php
$content = file_get_contents("https://hubofdata.ru/dataset/e7416648-e1f4-4feb-bc8a-454de729ab25/resource/2028ea46-cd87-45bb-ab39-4d68fb7082b6/download/edu.gov_2885_27.12.2011_recommended-books.json");

foreach (json_decode($content, true) as $eventrType => $events) {
    echo "<h1>Type: {$eventrType}</h1>";
foreach($events as $brand => $massiv)
print_r($massiv);

}
?>

Everything outputs, everything displays
I can’t figure out how to parse everything through an associative array in order to further write everything to the database

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shamanov, 2019-12-28
@SilenceOfWinter

In recent versions of mysql there is a json data type.
What is the format of the array? you can make a recursive function that forms a single-level array ['full_name' => '...', ..., 'indx' => '...'] path "Primary general education" > "Textbooks, the content of which corresponds to the federal state educational standard of primary general education" > "Russian language" to be transmitted by id'shnik

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question