res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Headers', 'origin, content-type, accept');
function get_request_result($request)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request);
/*Храним сеанс в сессии*/
curl_setopt($ch, CURLOPT_COOKIEFILE, true);
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookiefile");
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookiefile");
/**/
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
curl_close($ch);
return json_decode($server_output);
}
$request_token = "https://yandex.ru/maps/api/business/fetchReviews";
$token = get_request_result($request)->csrfToken;
$request_reviews = "https://yandex.ru/maps/api/business/fetchReviews?ajax=1&businessId=id_организации&csrfToken={$token}&page=1&pageSize=5";
$reviews_obj = get_request_result($request_reviews);
const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
while (walker.nextNode()) {
const text = walker.currentNode.textContent.trim();
if (text === '000-00-00') {
walker.currentNode.textContent = '111-11-11';
}
}
<?php
function draw($array)
{
foreach($array as $item)
{
if(isset($item['CHILD']))
{
echo '<li>'.$item['NAME'].'<ul>';
draw($item['CHILD']);
echo '</ul></li>';
}
else
{
echo '<li>'.$item['NAME'].'</li>';
}
}
}
$arr = [
'CHILD' => [
'16' => [
'NAME' => '1',
'CHILD' => [
'17' => [
'NAME' => 'a'
],
'18' => [
'NAME' => 'b'
]
]
]
]
];
echo '<ul>';
draw($arr['CHILD']);
echo '</ul>';