105 lines
3.1 KiB
PHP
105 lines
3.1 KiB
PHP
<?php
|
|
class Birt_test extends MY_Controller {
|
|
var $db;
|
|
|
|
public function index()
|
|
{
|
|
echo "BIRT TEST API";
|
|
}
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
// $this->db = $this->load->database("nas_report", true);
|
|
}
|
|
|
|
public function get () {
|
|
$jayParsedAry = [
|
|
[
|
|
"Title" => "The Lion King",
|
|
"Year" => "2019",
|
|
"Runtime" => "118 min",
|
|
"Poster" => "https://m.media-amazon.com/images/M/MV5BMjIwMjE1Nzc4NV5BMl5BanBnXkFtZTgwNDg4OTA1NzM@._V1_SX300.jpg"
|
|
],
|
|
[
|
|
"Title" => "Mowgli: Legend of the Jungle",
|
|
"Year" => "2018",
|
|
"Runtime" => "104 min",
|
|
"Poster" => "https://m.media-amazon.com/images/M/MV5BMjMzODc2NzU5MV5BMl5BanBnXkFtZTgwNTMwMTE3NjM@._V1_SX300.jpg"
|
|
],
|
|
[
|
|
"Title" => "Doctor Strange",
|
|
"Year" => "2016",
|
|
"Runtime" => "115 min",
|
|
"Poster" => "https://m.media-amazon.com/images/M/MV5BNjgwNzAzNjk1Nl5BMl5BanBnXkFtZTgwMzQ2NjI1OTE@._V1_SX300.jpg"
|
|
],
|
|
[
|
|
"Title" => "John Wick",
|
|
"Year" => "2014",
|
|
"Runtime" => "101 min",
|
|
"Poster" => "https://m.media-amazon.com/images/M/MV5BMTU2NjA1ODgzMF5BMl5BanBnXkFtZTgwMTM2MTI4MjE@._V1_SX300.jpg"
|
|
],
|
|
[
|
|
"Title" => "The Notebook",
|
|
"Year" => "2004",
|
|
"Runtime" => "123 min"
|
|
]
|
|
];
|
|
|
|
$param = $this->sys_input;
|
|
file_put_contents("/xtmp/birt-post-log",print_r($param,true));
|
|
$id = $param['id'];
|
|
$result = [
|
|
$jayParsedAry[$id]
|
|
];
|
|
echo json_encode($result);
|
|
}
|
|
public function getData()
|
|
{
|
|
$jayParsedAry = [
|
|
[
|
|
"Title" => "The Lion King",
|
|
"Year" => "2019",
|
|
"Runtime" => "118 min",
|
|
"Poster" => "https://m.media-amazon.com/images/M/MV5BMjIwMjE1Nzc4NV5BMl5BanBnXkFtZTgwNDg4OTA1NzM@._V1_SX300.jpg"
|
|
],
|
|
[
|
|
"Title" => "Mowgli: Legend of the Jungle",
|
|
"Year" => "2018",
|
|
"Runtime" => "104 min",
|
|
"Poster" => "https://m.media-amazon.com/images/M/MV5BMjMzODc2NzU5MV5BMl5BanBnXkFtZTgwNTMwMTE3NjM@._V1_SX300.jpg"
|
|
],
|
|
[
|
|
"Title" => "Doctor Strange",
|
|
"Year" => "2016",
|
|
"Runtime" => "115 min",
|
|
"Poster" => "https://m.media-amazon.com/images/M/MV5BNjgwNzAzNjk1Nl5BMl5BanBnXkFtZTgwMzQ2NjI1OTE@._V1_SX300.jpg"
|
|
],
|
|
[
|
|
"Title" => "John Wick",
|
|
"Year" => "2014",
|
|
"Runtime" => "101 min",
|
|
"Poster" => "https://m.media-amazon.com/images/M/MV5BMTU2NjA1ODgzMF5BMl5BanBnXkFtZTgwMTM2MTI4MjE@._V1_SX300.jpg"
|
|
],
|
|
[
|
|
"Title" => "The Notebook",
|
|
"Year" => "2004",
|
|
"Runtime" => "123 min"
|
|
]
|
|
];
|
|
|
|
$param = $this->sys_input;
|
|
$title = $param['Title'];
|
|
$result = [];
|
|
|
|
foreach ($jayParsedAry as $movie) {
|
|
if (isset($movie["Title"]) && $movie["Title"] === $title) {
|
|
// echo json_encode([$movie]);
|
|
array_push($result, $movie);
|
|
}
|
|
}
|
|
|
|
echo json_encode($result);
|
|
}
|
|
}
|