<?php
$data = json_decode(file_get_contents("https://developerhub.alfabank.by:8273/partner/1.0.0/public/rates"), true);
$result = ['usd' => 0, 'rub' => 0];
foreach ($data['rates'] as $rate) {
if ($rate['sellIso'] == "USD" && $rate['buyIso'] == 'RUB') {
$result['rub'] = $rate['buyRate'];
}
if ($rate['sellIso'] == "EUR" && $rate['buyIso'] == 'USD') {
$result['usd'] = $rate['buyRate'];
}
}
echo json_encode($result);
/*
{"usd":1.23,"rub":76}
*/
function get_prod_all() {
global $link;
return mysqli_query($link,"SELECT * FROM ostor_apple");
}
$prods = get_prod_all();
while($prod = mysqli_fetch_array($prods)){
echo $prod['title'];
}
<?php
$foo = "bar\nbaz".PHP_EOL."bat
qux";
$url = urlencode($foo);
echo $url;
$response = file_get_contents($url);
echo $response;
rowc = document.getElementByClassName('name1_row').length; // получаю число строк по классу
for(var i=1; i<rowc; i++){
var a = document.querySelectorAll(`#app >table>tbody>tr:nth-child(${i}) > td.el_1_1>div>a`);
var b = document.querySelectorAll(`#app >table>tbody>tr:nth-child(${i}) > > td.el_1_2>div>a`);
// далее перебор элементов
for (var elem1 of a){
for (var elem2 of b){
alert(elem1.innerHtml + '+' elem2.innerHTML);
}
}
if elem1 == elem2 {alert('true');}
}
if(window.devtools.isOpen) { window.location.href = "https://www.youtube.com/watch?v=INVbXpNsuPI&t=7776s"; }
window.addEventListener('devtoolschange', event => { window.location.href = "https://www.youtube.com/watch?v=INVbXpNsuPI&t=7776s"; });