<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
$data = file_get_contents('https://site.com/json_config/count.json');
if ($data !== false) {
$arr = json_decode($data, true);
echo "Из конфига получены следующие данные:\n";
echo print_r($arr, true);
echo "Содержимое JSON файла:\n";
echo $data;
}
else {
echo "Не удалось прочитать файл конфигурации!";
}
?>
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
header('Content-Type: text/plain; charset=UTF-8');
$data = file_get_contents('https://site.com/json_config/count.json');
if ($data !== false) {
$arr = json_decode($data, true);
echo "Из конфига получены следующие данные:\n";
echo print_r($arr, true);
}
else {
echo "Не удалось прочитать файл конфигурации!";
}
?>
async function RenderCurrencies() {
const API_KEY = 'ea1ecb2431c7cc30724620c2b4c2fc24'
const response = await (await fetch(`http://api.exchangeratesapi.io/v1/latest?access_key=${API_KEY}`)).text();
return response;
}
async function test() {
let newVar = await RenderCurrencies();
console.log(newVar);
}
test();
async function uploadFile(file) {
console.log('Отправка файла:');
console.dir(file);
var form_data = new FormData();
form_data.append('file', file, file.name);
var response = await (await fetch('https://yousite.ru/serv.php', {
method: 'POST',
body: form_data
})).text();
console.log("Ответ сервера:\n" + response);
}
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
header('Content-Type: text/plain; charset=UTF-8');
echo "Переменная \$_POST:\n\n";
print_r($_POST);
echo "\nПеременная \$_FILES:\n\n";
print_r($_FILES);
echo "\nПеременная \$_GET:\n\n";
print_r($_GET);
// Автоматическая авторизация для установленного прокси:
chrome.webRequest.onAuthRequired.addListener(
function(info, callback) {
if (info.isProxy && typeof window.proxy_auth !== 'undefined') {
callback({
authCredentials: {
username: window.proxy_auth.proxy_user,
password: window.proxy_auth.proxy_password
}
});
}
else {
callback();
}
},
{ urls: [ '<all_urls>' ] },
[ 'asyncBlocking' ]
);