Good night)) Please help with the parser, it loads for more than 60 seconds, trouble, maybe as you can with other requests, change something, here is the parser script itself:

<?php set_time_limit (90); ?> <head> <style type="text/css"> table.table1{ font-family: "Trebuchet MS", sans-serif; font-size: 16px; font-weight: bold; line-height: 1.4em; font-style: normal; border-collapse:separate; } .table1 thead th{ padding:15px; color:#fff; text-shadow:1px 1px 1px #568F23; border:1px solid #93CE37; border-bottom:3px solid #9ED929; background-color:#9DD929; background:-webkit-gradient( linear, left bottom, left top, color-stop(0.02, rgb(123,192,67)), color-stop(0.51, rgb(139,198,66)), color-stop(0.87, rgb(158,217,41)) ); background: -moz-linear-gradient( center bottom, rgb(123,192,67) 2%, rgb(139,198,66) 51%, rgb(158,217,41) 87% ); -webkit-border-top-left-radius:5px; -webkit-border-top-right-radius:5px; -moz-border-radius:5px 5px 0px 0px; border-top-left-radius:5px; border-top-right-radius:5px; } .table1 thead th:empty{ background:transparent; border:none; } .table1 tfoot td{ color: #9CD009; font-size:32px; text-align:center; padding:10px 0px; text-shadow:1px 1px 1px #444; } .table1 tfoot th{ color:#666; } .table1 tbody td{ padding:2px; text-align:center; background-color:#DEF3CA; border: 2px solid #E7EFE0; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#666; text-shadow:1px 1px 1px #fff; } .table1 tbody span.check::before{ content : url(./images/check0.png) } </style> <style> *{ margin:0; padding:0; } body{ font-family: Georgia, serif; font-size: 20px; font-style: italic; font-weight: normal; letter-spacing: normal; background: #f0f0f0; } #content{ background-color:#fff; padding:40px; } #content h1{ font-family:"Trebuchet MS",sans-serif; color:#1D81B6; font-weight:normal; font-style:normal; font-size:42px; text-shadow:1px 1px 1px #aaa; } #content h2{ font-family:"Trebuchet MS",sans-serif; font-size:34px; font-style:normal; background-color:#f0f0f0; margin:40px 0px 30px -40px; padding:0px 40px; clear:both; float:left; width:100%; color:#aaa; text-shadow:1px 1px 1px #fff; } </style> </head> <table class="table1"> <tbody> <thead> <tr> <th>Расса</th> <th>Ху Ис ХУ?</th> <th scope="col" abbr="Живой">Живой??</th> <th scope="col" abbr="Копает">Копает?</th> <th scope="col" abbr="Джахом">С Джахом?</th> <th scope="col" abbr="Бой">Бой?</th> <th scope="col" abbr="Благи">Благи</th> <th scope="col" abbr="Лив">Лив</th> </tr> </thead> <?php $content = file_get_contents('http://w2.dwar.ru/instance_stat.php?outside=1&instance_id=131444356&finish=0'); preg_match_all("'userToTag\(\'(.*?)\'\);'si", $content, $match); 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; } ?> <?php foreach ($match[1] as $nickname){ $ups = "&noredir=9462fa1c293699b04eb15e8b8d84b9ba"; $url = "http://w2.dwar.ru/user_info.php?nick=".urlencode($nickname) . $ups; $ssil = '<a href='.$url.'>'.$nickname.'</a>'; $page = getPage($url); // УРОВЕНЬ $lvl = file_get_contents($url); $pos = strpos($lvl, '&lvl='); $lvl = substr($lvl, $pos); $pos = strpos($lvl, '&tSrc=images'); $lvl = substr($lvl, 0, $pos); $lvl = str_replace('&lvl=','', $lvl); // УРОВЕНЬ // ЗВАНИЕ $zvanie = file_get_contents($url); $pos = strpos($zvanie, '/images/ranks/'); $zvanie = substr($zvanie, $pos); $pos = strpos($zvanie, '.gif" width="13" height="13" border="0" alt="" align="absmiddle">'); $zvanie = substr($zvanie, 0, $pos); $zvanie = str_replace('/images/ranks/','', $zvanie); // ЗВАНИЕ // КЛАН $clan = file_get_contents($url); if (strpos($clan, 'images/data/clans/')){ $pos = strpos($clan, 'images/data/clans/'); $clan = substr($clan, $pos); $pos = strpos($clan, '.gif" width="13" height="13" border="0" alt="" align="absmiddle">'); $clan = substr($clan, 0, $pos); $clan = str_replace('images/data/clans/','', $clan); $sclan = $clan; } else { $sclan = ''; } /* Выполняем запрос. Если нез клана не выводить его. */ if ($sclan) { $clanicus = '<img src="http://w2.dwar.ru/images/data/clans/'.$sclan.'.gif" border="0" alt="" />'; } else { $clanicus = ''; } // КЛАН /* Выполняем запрос. Если у персонажа нет звания, либо скрыт ничего не выводить. */ if ($zvanie) { $zvann = '<img src="http://w2.dwar.ru/images/ranks/'.$zvanie.'.gif" border="0" alt="" />'; } else { $zvann = ''; } // ЖИВОЙ или ТРУП $trup = file_get_contents($url); $pos = strpos($trup, '&ghost='); $trup = substr($trup, $pos); $pos = strpos($trup, 'LC_id='); $trup = substr($trup, 0, $pos); $trup = str_replace('&ghost=','', $trup); if ($trup == 0) { $trupcus = '<img src="./images/check0.png" border="0" alt="" />'; } else { $trupcus = '<img src="./images/Red_x.png" border="0" alt="" />'; } // ЖИВОЙ или ТРУП // КОПАЕТ&nbsp;ИЛИ&nbsp;НЕТ $kopalk = file_get_contents($url); $pos = strpos($kopalk, '&farming='); $kopalk = substr($kopalk, $pos); $pos = strpos($kopalk, '&PkPath='); $kopalk = substr($kopalk, 0, $pos); $kopalk = str_replace('&farming=','', $kopalk); if ($kopalk == 1) { $kopal = '<img src="./images/check0.png" border="0" alt="" />'; } else { $kopal = '<img src="./images/Red_x.png" border="0" alt="" />'; } // КОПАЕТ ИЛИ НЕТ // Есть хаос или нет $haosin = file_get_contents($url); $pos = strpos($haosin, 'medalchaos_red'); $haosin = substr($haosin, $pos); $pos = strpos($haosin, '.gif'); $haosin = substr($haosin, 0, $pos); $haosin = str_replace('medalchaos_red','', $haosin); if ($haosin == '1311') { $haosina = '<img src="./images/check0.png" border="0" alt="" />'; } else { $haosina = '<img src="./images/Red_x.png" border="0" alt="" />'; } // Есть хаос или нет // идет бой или нет ? $fight = file_get_contents($url); $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 = '<img src="./images/Red_x.png" border="0" alt="" />'; } // конец боя $blag = 'http://w2.dwar.ru/effect_info.php?nick='.urlencode($nickname); $blagi = '<a href="'.$blag.'" target="_blank">Благи</a>'; $rass_mag = '<img src="./images/ico_magmar.gif" border="0" alt="" />'; $rass_hum = '<img src="./images/ico_human.gif" border="0" alt="" />'; // Проверка покинул пещеры $metro = file_get_contents($url); $pos = strpos($metro, '&tLocation='); $metro = substr($metro, $pos); $pos = strpos($metro, '&tTitle='); $metro = substr($metro, 0, $pos); $metro = str_replace('&tLocation=','', $metro); if ($metro == '%D0%9A%D1%80%D0%B8%D1%81%D1%82%D0%B0%D0%BB%D0%BB%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B5+%D0%BF%D0%B5%D1%89%D0%B5%D1%80%D1%8B') { $metrop = ''; } else { $metrop = '<img src="./images/Red_x.png" border="0" alt="" />'; } // заканчиваем вывод благ if (preg_match('/Магмары/',$page)) { ?> <tr> <td><?php echo $rass_mag ?></td> <td><?php echo $clanicus; ?> <?php echo $zvann; ?> <?php echo $nickname; ?> [<?php echo $lvl; ?>] <?php echo '<a href="' . $url . '" target="_blank"><img src="http://w2.dwar.ru/images/player_info.gif" border=0 width=10 height=10 align="absmiddle"></a>' ?></td> <td><?php echo $trupcus ?></td> <td><?php echo $kopal ?></td> <td><?php echo $haosina ?></td> <td><?php echo $fightres ?></td> <td><?php echo $blagi ?></td> <td><?php echo $metrop ?></td> </tr> <?php } if (preg_match('/Люди/',$page)) { ?> <tr> <td><?php echo $rass_hum ?></td> <td><?php echo $clanicus; ?> <?php echo $zvann; ?> <?php echo $nickname; ?> [<?php echo $lvl; ?>] <?php echo '<a href="' . $url . '" target="_blank"><img src="http://w2.dwar.ru/images/player_info.gif" border=0 width=10 height=10 align="absmiddle"></a>' ?></th> <td><?php echo $trupcus ?></td> <td><?php echo $kopal ?></td> <td><?php echo $haosina ?></td> <td><?php echo $fightres ?></td> <td><?php echo $blagi ?></td> <td><?php echo $metrop ?></td> </tr> <?php } } ?> </tbody> </table> 
  • file_get_contents($url); In the cycle, it is enough to call 1 time - Dolbik
  • Is there a mistake or new rules of the Russian language? /* Выполняем запрос. Если нез клана не выводить его. */ /* Выполняем запрос. Если нез клана не выводить его. */ - Sergey
  • Yes, then at night I printed it for myself)) my eyes were closed, I wanted to sleep) I understood about the file_get_contents($url); account file_get_contents($url); )) I'll clean up now) - Constantine
  • Am I right? i $get = file_get_contents($url); and then replaced the request everywhere with $lvl = $get; ,$zvanie = $get; $lvl = $get; ,$zvanie = $get; etc. - Constantine
  • Thank you))) it loads very quickly in comparison with the previous version, 11-13 seconds is the answer) - Konstantin

0