-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathendpointTest.php
52 lines (43 loc) · 1.62 KB
/
endpointTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?PHP
/*
----------------------------------
------ Created: 091320 ------
------ Austin Best ------
----------------------------------
*/
$endpoints = array(0 => array('app' => 'prowlarr', 'endpoint' => 'statistics'),
1 => array('app' => 'radarr', 'endpoint' => 'moviesearch?movieids=[1053]'),
2 => array('app' => 'radarr', 'endpoint' => 'jackett'),
3 => array('app' => 'radarr', 'endpoint' => 'movie/lookup/tmdb?tmdbId=5176'),
4 => array('app' => 'radarr', 'endpoint' => 'movie?tmdbId=5176'),
);
define('ENDPOINT', 0);
define('RADARR_API_KEY', '');
define('RADARR_URL', 'localhost');
define('RADARR_PORT', 7878);
define('PROWLARR_API_KEY', '');
define('PROWLARR_URL', 'localhost');
define('PROWLARR_PORT', 9696);
if ($endpoints[ENDPOINT]['app'] == 'prowlarr')
{
$url = 'http://'. PROWLARR_URL .':'. PROWLARR_PORT .'/api/v1/'. $endpoints[ENDPOINT]['endpoint'];
$api = PROWLARR_API_KEY;
}
if ($endpoints[ENDPOINT]['app'] == 'radarr')
{
$url = 'http://'. RADARR_URL .':'. PROWLARR_PORT .'/api/v3/'. $endpoints[ENDPOINT]['endpoint'];
$api = RADARR_API_KEY;
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json', 'X-Api-Key:'. $api));
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
echo 'URL: '. $url .'<br>';
echo 'API: '. $api .'<br><br>';
echo '<pre>';
print_r($response);
echo '</pre>';
?>