This repository was archived by the owner on Jan 1, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+ include ("../api_start.php " );
3+
4+
5+ $ listId = $ _GET ["listId " ];
6+
7+ $ listIds = exec ("python IMDBAPI.py list $ listId " );
8+ //$ids = "1";
9+ $ result = $ db ->query ("SELECT m.* FROM movies m WHERE m.imdb_id in ( $ listIds) " );
10+
11+ $ response = array ();
12+
13+ while ($ arr = $ result ->fetch_assoc ()) {
14+ $ response [] = $ arr ;
15+ // var_dump($arr);
16+ }
17+
18+ $ res = json_encode (utf8ize ($ response ));
19+
20+ echo $ res ;
21+
22+
23+ ?>
Original file line number Diff line number Diff line change 1+ <?php
2+ include ("../api_start.php " );
3+
4+ $ limit = $ _GET ["limit " ];
5+
6+ $ listIds = exec ("python IMDBAPI.py popular $ limit " );
7+ $ exploded = explode (", " , $ listIds );
8+ $ orderedListIds = array ();
9+ foreach ($ exploded as $ id ) {
10+ $ orderedListIds [] = str_ireplace ("' " , "" , $ id );
11+ }
12+ //$ids = "1";
13+ $ result = $ db ->query ("SELECT m.* FROM movies m WHERE m.imdb_id in ( $ listIds) " );
14+
15+ $ response = array ();
16+
17+ while ($ arr = $ result ->fetch_assoc ()) {
18+ $ index = array_search ($ arr ["imdb_id " ], $ orderedListIds );
19+ //var_dump($index);
20+ $ response [$ index ] = $ arr ;
21+ // var_dump($arr);
22+ }
23+
24+ $ resp = $ response ;
25+ ksort ($ resp );
26+
27+ $ res = json_encode (utf8ize ($ resp ));
28+
29+ echo $ res ;
30+
31+
32+ ?>
You can’t perform that action at this time.
0 commit comments