Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- require_once 'db.php';
- require_once 'simple_html_dom.php';
- ini_set('error_reporting', E_ALL);
- ini_set('display_errors', 1);
- ini_set('display_startup_errors', 1);
- mysql_query("DELETE FROM cms_uhl");
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, 'http://r-hockey.ru/game.asp?CurrentTournier=11466');
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
- $str = curl_exec($curl);
- curl_close($curl);
- $html= str_get_html($str);
- foreach($html->find('script,link,comment') as $tmp) {
- $tmp->outertext = '';
- }
- $j=0;
- foreach ($html->find('table.TCommands tr') as $tr) {
- if ($j > 0) {
- $number = strip_tags($tr->find('td',0));
- $comanda = strip_tags($tr->find('td',1));
- $i = strip_tags($tr->find('td',2));
- $v = strip_tags($tr->find('td',3));
- $v_ot = strip_tags($tr->find('td',4));
- $n = strip_tags($tr->find('td',5));
- $p_ot = strip_tags($tr->find('td',6));
- $p = strip_tags($tr->find('td',7));
- $sh = str_replace(" ", "", strip_tags($tr->find('td',8)));
- $o = strip_tags($tr->find('td',9));
- mysql_query("INSERT INTO `cms_uhl` SET
- `number` = '$number',
- `comanda` = '$comanda',
- `i` = '$i',
- `v` = '$v',
- `v_ot` = '$v_ot',
- `n` = '$n',
- `p_ot` = '$p_ot',
- `p` = '$p',
- `sh` = '$sh',
- `o` = '$o',
- `update_date`=NOW()
- ");
- }
- $j++;
- }
- //освобождаем ресурсы
- $html->clear();
- unset($html);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement