28 lines
908 B
PHP
28 lines
908 B
PHP
<?php
|
|
$config = parse_ini_file(__DIR__ . '/../config/flashii.ini');
|
|
|
|
define('TETRIO_TOKEN', $config['tetrio-token']);
|
|
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
|
|
if(empty($_GET['q'])) {
|
|
echo '{"success":false,"errors":[{"location":"body","param":"query","value":"","msg":"query missing"}]}';
|
|
return;
|
|
}
|
|
|
|
$curl = curl_init($config['tetrio-user-reverse']);
|
|
curl_setopt_array($curl, [
|
|
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:86.0) Gecko/20100101 Firefox/86.0',
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
CURLOPT_POST => true,
|
|
CURLOPT_POSTFIELDS => json_encode(['query' => (string)filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING)]),
|
|
CURLOPT_HTTPHEADER => [
|
|
'Authorization: Bearer ' . TETRIO_TOKEN,
|
|
'Accept: application/json',
|
|
'Content-Type: application/json',
|
|
],
|
|
]);
|
|
$out = curl_exec($curl);
|
|
curl_close($curl);
|
|
|
|
echo $out;
|