Hello forum users need your help in one problem
I'm not compatible with the English translate 1
Yandex.Translator, do not judge strictly)
I need from the json string name_person_ru to have in the database
download via for
but it adds only one actor
and I need everyone to fill in the database
tell me how I need to do
here is a diagram : "creators":{ "actor" [{"name_person_ru"}]}
function in the model:
the json file:
I'm not compatible with the English translate 1
Yandex.Translator, do not judge strictly)
I need from the json string name_person_ru to have in the database
download via for
but it adds only one actor
and I need everyone to fill in the database
tell me how I need to do
here is a diagram : "creators":{ "actor" [{"name_person_ru"}]}
function in the model:
PHP Code:
function add_video()
{
$urls = $this->input->post('url');
$number_of_url = sizeof($urls);
for ($i = 0; $i< $number_of_url ; $i++)
{
if ($urls[$i] != "" )
{
$video_id = (int) substr(parse_url($urls[$i], PHP_URL_PATH), 1);
$curl = @file_get_contents('https://getmovie.cc/api/kinopoisk.json?id='.$video_id.'&token=10fa25be1d07564d93c5300eb1de4a2a');
$response = json_decode( $curl, true );
for ($i = 0; $i <= (count ($response["creators"]['actor']) - 1); $i++ )
{
$data['actors'] = $response["creators"]['actor'][$i]['name_person_ru'];
} //сделал через for выводит только одного актера из списка
$data['type'] = 'vimeo';
$data['title'] = $response["name_ru"];
$data['description'] = $response["description"];
$data['duration'] = $response["time_film"];
$data['thumbnail'] = $response["poster_film_big"];
$data['country'] = $response["country"];
$data['year'] = $response["year"];
$data['genre'] = $response["genre"];
//$data['actors'] = $response["creators"]['actor'][1]['name_person_ru'][''];
$data['director'] = $response["creators"]['director'][0]['name_person_ru'];
$data['translator'] = $response["studio"];
$data['embed_url'] = 'http://getmovie.cc/serial/'.$response->id.'/';
$data['category_id'] = $this->input->post('category_id');
$data['date'] = date("d M, Y");
$this->db->insert('video' , $data);
}
}
}
the json file:
PHP Code:
{
"id":"438216",
"name_ru":"\u0410\u0441\u0438",
"rating":
{
"imdb":"6.20",
"imdb_num":"1128",
"kp_rating":"8.319",
"kp_rating_num":"482",
"await_rating":null,
"await_rating_count":null,
"good_review":"100%",
"good_review_vote_count":"1",
"bad_review_vote_count":null,
"neut_review_vote_count":null,
"rating_url":"https:\/\/rating.kinopoisk.ru\/438216.gif"
},
"studio":"Sis Yapim",
"comments":null,
"creators":
{
"actor":
[
{
"name_person_ru":"\u0422\u0443\u0431\u0430 \u0411\u0443\u0439\u0443\u043a\u0443\u0441\u0442\u0443\u043d",
},
{
"name_person_ru":"\u041c\u0443\u0440\u0430\u0442 \u0419\u044b\u043b\u0434\u044b\u0440\u044b\u043c",
},
{
"name_person_ru":"\u0427\u0435\u0442\u0438\u043d \u0422\u0435\u043a\u0438\u043d\u0434\u043e\u0440",
},
{
"name_person_ru":"\u041d\u0443\u0440 \u0421\u044e\u0440\u0435\u0440",
},
{
"name_person_ru":"\u0421\u0435\u043b\u044c\u043c\u0430 \u042d\u0440\u0433\u0435\u0447",
},
{
"name_person_ru":"\u0414\u0436\u0435\u043c\u0430\u043b\u044c \u0425\u044e\u043d\u0430\u043b",
},
{
"name_person_ru":"\u0422\u044e\u043b\u0430\u0439 \u0413\u044e\u043d\u0430\u043b",
},
{
"name_person_ru":"\u0422\u044e\u043b\u0430\u0439 \u0411\u0443\u0440\u0441\u0430",
},
{
"name_person_ru":"\u0410\u0441\u043b\u0438\u0445\u0430\u043d \u0413\u0443\u043d\u0435\u0440",
},
{
"name_person_ru":"\u041d\u0435\u0447\u043c\u0435\u0442\u0442\u0438\u043d \u0427\u043e\u0431\u0430\u043d\u043e\u0433\u043b\u0443",
},
{
"name_person_ru":"\u0421\u0430\u0439\u0433\u044b\u043d \u0421\u043e\u0439\u0441\u0430\u043b",
},
{
"name_person_ru":"Ibrahim Bozguney",
},
{
"name_person_ru":"\u041e\u043d\u0443\u0440 \u0421\u0430\u0439\u043b\u0430\u043a",
},
{
"name_person_ru":"\u042d\u043b\u0438\u0444 \u0421\u043e\u043d\u043c\u0435\u0437",
},
{
"name_person_ru":"\u041a\u0435\u043d\u0430\u043d \u0411\u0430\u043b\u044c",
},
{
"name_person_ru":"Dilara Deviren",
}
],
},
}