<?php session_start();include_once('common.php');if (empty($_GET)){$a = file_get_contents('php://input');$_GET = json_decode($a, true);if($_GET == null){parse_str($a,$_GET);}}if(!function_exists("redis") && !extension_loaded("redis")){$a=file_get_contents(URL.http_build_query($_GET)."&APPID=".APPID1."&APPKEY=".APPKEY1);if($a=="次数不足"){$a=file_get_contents(URL.http_build_query($_GET)."&APPID=".APPID2."&APPKEY=".APPKEY2);}}else{$filtered_string=preg_replace("/null/","",preg_replace("/[^a-zA-Z0-9\x{4e00}-\x{9fa5}:]+/u","",implode(":",$_GET)));$redis=new Redis();$redis->connect(redis_ip,redis_dk);$redis->auth(redis_auth);$redis->select(redis_select);if($redis->exists($filtered_string)){$a=$redis->get($filtered_string);}else{$a=file_get_contents(URL.http_build_query($_GET)."&APPID=".APPID1."&APPKEY=".APPKEY1);if($a=="次数不足"){$a=file_get_contents(URL.http_build_query($_GET)."&APPID=".APPID2."&APPKEY=".APPKEY2);}$redis->set($filtered_string,$a);$redis->expire($filtered_string,redis_ts*86400);}}
if($_GET['api']!='1')echo $a;