я парсел один сайт вот код
index.php (+/-)
<?php
define('_IN_JOHNCMS', 1);
$headmod = 'myscore';
require_once '../incfiles/core.php';
$textl = 'Футбол онлайн';
require_once '../incfiles/head.php';
function query($url)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, 'Opera/9.80 (Windows NT 5.1; U; ru) Presto/2.2.15 Version/10.10');
curl_setopt($curl, CURLOPT_AUTOREFERER, false);
curl_setopt($curl, CURLOPT_REFERER, $_SERVER["HTTP_HOST"]);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: text/html, application/xml, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;', 'Accept-Language: ru, en, *;', 'Accept-Charset: iso-8859-1, utf-8, utf-16, *;', 'Accept-Encoding: identity;', 'Connection: close'));
curl_setopt($curl, CURLOPT_TIMEOUT, 100);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
return $result;
}
$html = query('http://sayt.uz/oz/m/games-calendar?');
$source = preg_match_all('|<div class="tourney-name">(.*?)<div>|si',$html,$sources);
$h_c = (count($sources[0]) -1);
$rezultat = array();
for($i=0; $i <= $h_c; $i++)
{
$title = preg_match_all('|<div class="tourney-name">(.*?)<\/div>|si',$sources[0][$i],$titles);
$match = preg_match_all('|<td class="align-left crop-text"(.*?)>(.*?)<\/td>|si',$sources[0][$i],$matches);
$match2 = preg_match_all('|<td class="center" style="width: 17%">(.*?)<\/td>|si',$sources[0][$i],$matches2);
$match3 = preg_match_all('|<td class="center" style="width: 20%">(.*?)<\/td>|si',$sources[0][$i],$matches3);
$matcha = preg_match_all('|<a class="score"(.*?)" href="(.*?)">(.*?)<\/a>|si',$sources[0][$i],$link);
$rezultat[$i]['title'] = $titles[1][0];
$rezultat[$i]['matches'] = $matches[0];
$rezultat[$i]['matches2'] = $matches2[0];
$rezultat[$i]['matches3'] = $matches3[0];
$rezultat[$i]['link'] = $link[4];
}
$f_c = (count($rezultat) -1);
echo'<div class="match-center-list">';
for($i=0; $i <= $f_c; $i++)
{
echo '<div class="phdr"><b>' . $rezultat[$i]['title'] . '</b></div>';
echo'<div id="w0" class="grid-view"><table class="stats-table games-table"><tbody>';
$ma_c = (count($rezultat[$i]['matches']) -1);
for($j=0; $j <= $ma_c; $j++)
{
$rezultat[$i]['matches2'][$j] = preg_replace('|<span class="matchcenter-sprite-finished"></span>|si', '<img src="/football/go.gif">', $rezultat[$i]['matches2'][$j]);
$rezultat[$i]['matches2'][$j] = preg_replace('|<span class="matchcenter-sprite-cancelled"></span>|si', '<img src="/football/ex.gif">', $rezultat[$i]['matches2'][$j]);
$rezultat[$i]['matches'][$j] = preg_replace('|<img src="/static/(.*?)">|si', '', $rezultat[$i]['matches'][$j]);
echo '' . $rezultat[$i]['matches2'][$j] . '
' . $rezultat[$i]['matches'][$j] . '
' . str_replace('href="/oz/m/event?id=', 'href="test1.php?id=', $rezultat[$i]['matches3'][$j]) . '</a>
</tr>';
}
echo'</tbody></table></div>';
}
echo'</div>';
require_once '../incfiles/end.php';при приходе test1.php?id=здесь_ид&type=spycosy
не выводит результаты
test1.php (+/-)
define('_IN_JOHNCMS', 1);
$headmod = 'myscore';
require_once '../incfiles/core.php';
$textl = 'Футбол онлайн';
require_once '../incfiles/head.php';
function query($url)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, 'Opera/9.80 (Windows NT 5.1; U; ru) Presto/2.2.15 Version/10.10');
curl_setopt($curl, CURLOPT_AUTOREFERER, false);
curl_setopt($curl, CURLOPT_REFERER, $_SERVER["HTTP_HOST"]);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: text/html, application/xml, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;', 'Accept-Language: ru, en, *;', 'Accept-Charset: iso-8859-1, utf-8, utf-16, *;', 'Accept-Encoding: identity;', 'Connection: close'));
curl_setopt($curl, CURLOPT_TIMEOUT, 100);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
return $result;
}
if (!$_GET['id']) header("Location: index.php");
$html = query('http://championat.asia/oz/m/event?' . $_GET['id']. '');
далее код