Код: Выделить всё
FormatException: Unexpected character (at character 1)
...
//Full html code
function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;fd[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),b=toNumbers("98344c2eee86c3994890592585b49f80"),c=toNumbers("3bbe2c7d2bd575630c6e4c0b1537ed79");document.cookie="__test="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/"; location.href="https://www.quelib.com/src/get_api/get_uni.php?i=1";This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support
Код: Выделить всё
headers: {
'Content-Type': 'application/json',
'Charset': 'utf-8',
"Accept": 'application/json'
}
Код: Выделить всё
Future getAllUni() async {
List uniAll = [];
try {
var apiUrl = url + "get_api.php";
final Map data = {"action": "GET_UNI"};
await http.post(Uri.parse(apiUrl), body: jsonEncode(data), headers: {
'Content-Type': 'application/json',
'Charset': 'utf-8',
"Accept": 'application/json'
}).then((response) {
debugPrint(response.body);
debugPrint(json.decode(response.body));
print(response.body);
print(json.decode(response.body));
if (json.decode(response.body) == 'no_data') {
} else {
List jDecode = json.decode(response.body);
if (response.statusCode == 200) {
jDecode.forEach((e) {
print(e.toString());
uniAll.add(e['name'].toString());
});
} else {}
}
});
} catch (e) {
ContentReport.report.catchReport("get_api.dart", "getAllUni",
e.toString());
}
return uniAll;
}
Код: Выделить всё
$action = $_POST['action'];
if($action == 'GET_UNI') {
$sql = $conn->prepare("SELECT * FROM uni ORDER BY name ASC");
$sql->execute();
$res = $sql->get_result();
if (mysqli_num_rows($res) > 0) {
while ($row = $res -> fetch_assoc()) {
$data[] = $row;
}
echo json_encode($data);
}
else {
echo json_encode("error_data");
}
}
Мобильная версия