There is a grabber script, it’s just robbing just one digit from the site, it’s either 1 or 0 ... but when there are a lot of nicknames in a variable, the data processing is very long ... minutes, the information was updated by itself, and when the page was requested, the response of the already processed information was given some time before ..) Here is the script itself

<?php function getPage($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 60); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12'); $data_fin = curl_exec($ch); curl_close($ch); return $data_fin; } $ups = "&noredir=9462fa1c293699b04eb15e8b8d84b9ba"; $nick_names = ['FC SD']; // пример произвольного массива ник-неймов $length = count($nick_names); for ($i = 0; $i < $length; $i++) { $url = "http://w2.dwar.ru/user_info.php?nick=" . urlencode($nick_names[$i]) . $ups; $page = getPage($url); $content = file_get_contents($url); $pos = strpos($content, '&lvl='); $content = substr($content, $pos); $pos = strpos($content, '&tSrc=images'); $content = substr($content, 0, $pos); $content = str_replace('&lvl=','', $content); $icon = "<a href='http://w2.dwar.ru/clan_info.php?clan_id=1070' title='TRIAS Dius'><img src='http://w2.dwar.ru/images/data/clans/3212331.gif' border=0 width=13 height=13 align='absmiddle'></a>"; if (preg_match('/online=1/',$page)) { echo '<button class="btn-clipboard" data-clipboard-text="prv[' . $nick_names[$i] . ']"><img src="http://www.dwar.ru/images/news-arrow.gif"></button> ' . $nick_names[$i] . ' [' . $content . ']<a href="' . $url . '" target="_blank"><img src="http://w2.dwar.ru/images/player_info.gif" border=0 width=10 height=10 align="absmiddle"></a> : <span style="color: green;"><b>Online</b></span><br><br>'; } else { echo '<button class="btn-clipboard" data-clipboard-text="prv[' . $nick_names[$i] . ']"><img src="http://www.dwar.ru/images/news-arrow.gif"></button> ' . $nick_names[$i] . ' [' . $content . ']<a href="' . $url . '" target="_blank"><img src="http://w2.dwar.ru/images/player_info.gif" border=0 width=10 height=10 align="absmiddle"></a> : <span style="color: red;"><b>Offline</b></span><br><br>'; } } ?> 

    1 answer 1

    You need to split the task into two. The first task is run by cron every few minutes (selected experimentally) and robs data for each user. The results of the loot are added to the base.

    The second script is already working for the user. When he needs to show the state, he simply goes to the base and gives the result.

    • I basically assumed it)) but you don’t have an example of something that can be disassembled)) never did such a thing, and the site loads very much ((( Konstantin
    • I found something, I will try to pick it up at night myself, if it doesn't work, then I will ask a new question, thank you) - Konstantin