Hello) who can teach, suggest, put on the right path as they say ... read, looked, thought and thought of nothing at the expense of curl_multi .. I can’t understand how to remake what we have)
Here is my skipt, the list contains about 120 nicknames, which are then pre-added to the link by adding a nickname to the end of the link ... and processing for each value .. If you add 5-6, then the allowable waiting time, but when there are a lot of them and very slowly, everything ... I ask for help ...
<?php if($_SERVER['REQUEST_METHOD'] == 'POST') { $message = $_POST['message']; $message = strip_tags($message); $message = preg_split("/[?[][\w]{1,2}]/", $message); $message = preg_replace('/ {2}/','',$message); 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 = ['Пишите.. не сомнивайтесь, будьте первыми )) ']; // пример произвольного массива ник-неймов $length = count($message); for ($i = 0; $i < $length; $i++) { $nickn = trim($message[$i]); $nickname = urlencode($nickn); $url = "http://w2.dwar.ru/user_info.php?nick=".$nickname . $ups; $page = getPage($url); $get = file_get_contents($url); // каков уровень в теге $content ? $content = $get; $pos = strpos($content, '&lvl='); $content = substr($content, $pos); $pos = strpos($content, '&tSrc=images'); $content = substr($content, 0, $pos); $content = str_replace('&lvl=','', $content); // конец уровня // идет бой или нет ? $fight = $get; $pos = strpos($fight, '&fightId='); $fight = substr($fight, $pos); $pos = strpos($fight, '&farming='); $fight = substr($fight, 0, $pos); $fight = str_replace('&fightId=','', $fight); if ($fight) { $fightres = '<a href="http://w2.dwar.ru/fight_info.php?fight_id='.$fight.'" target="_blank">В БОЮ</a>'; } else { $fightres = 'СВОБОДЕН'; } // конец боя if (preg_match('/Магмары/',$page)) { echo '<button class="btn-clipboard" data-clipboard-text="prv[' . $nickn . ']"><img src="http://www.dwar.ru/images/news-arrow.gif"></button> '. $message[$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>('.$fightres.')</b></span><br><br>'; } else { echo ''; } } ?> <br /> Если никто не отобразился значит вы ни скопировали ни одного магмара))) <br /> <br /> При нажатии на кнопочку <button class="btn-clipboard" data-clipboard-text="Копируется ник"><img src="http://www.dwar.ru/images/news-arrow.gif"></button> мы копируем ник в буфер обмена в таком формате:<br /> prv[Ник жертвы] <script src="http://trias.cf/wp-content/themes/new2/js/clipboard.min.js"></script> <script> new Clipboard('.btn-clipboard'); </script> <?php } else { // дополнительно :) }?>