<?php
error_reporting(0);
$page = $_GET['page'];
$url = "http://****/pubFileList.php?dirId=0001¤tPageNo=$page"; //目标站
$fp = fopen($url, "r") or die("超时");
$fcontents = file_get_contents($url);
eregi("</tr><tr><td height(.*)</td></tr>
<tr>
<td ", $fcontents, $regs);
$temp0 = explode("href",$regs[0]);
$account = sizeof($temp0);
//print_r($temp0);
$address = array();
$title = array();
$i = 0;
//echo $news[$i];
while($i<$account)
{
ereg("='(.*);return", $temp0[$i+1], $news);
//print_r($news);
$add_temp = explode("='",$news[0]);
//print_r($add_temp);
ereg("(.*)'", $add_temp[1], $add);
//echo $add;
//$tit_temp = explode("='",$news[$i]);
ereg("(.*)'", $add_temp[2], $tit);
//echo $tit;
$id_temp =substr($add[0],0,strlen($add[0])-1);
$id_news = explode("?id=",$id_temp);
$rows[]=$id_news[1];
$rows[] = substr($tit[0],0,strlen($tit[0])-1);
unset($id_news);
unset($add);
unset($tit);
unset($news);
unset($add_temp);
$i++;
}
header('Content-Type: text/xml');
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
echo "<newslist>\n";
for($i = 0;$i < $account-1;$i++)
{
echo "<news id=\"".($i+1)."\">\n";
echo "<title>".$rows[($i)*2+1]."</title>\n";
echo "<articleid>".$rows[2*($i)]."</articleid>\n";
echo "</news>\n";
}
echo "</newslist>";
?>
echo "<title>"这个位置会报错。但是,如果数据来源是数据库而不是网页抓取的话,这个代码没有任何问题。请大神看看如何解决。
这是报的错
这是查看的源码:

error_reporting(0);
$page = $_GET['page'];
$url = "http://****/pubFileList.php?dirId=0001¤tPageNo=$page"; //目标站
$fp = fopen($url, "r") or die("超时");
$fcontents = file_get_contents($url);
eregi("</tr><tr><td height(.*)</td></tr>
<tr>
<td ", $fcontents, $regs);
$temp0 = explode("href",$regs[0]);
$account = sizeof($temp0);
//print_r($temp0);
$address = array();
$title = array();
$i = 0;
//echo $news[$i];
while($i<$account)
{
ereg("='(.*);return", $temp0[$i+1], $news);
//print_r($news);
$add_temp = explode("='",$news[0]);
//print_r($add_temp);
ereg("(.*)'", $add_temp[1], $add);
//echo $add;
//$tit_temp = explode("='",$news[$i]);
ereg("(.*)'", $add_temp[2], $tit);
//echo $tit;
$id_temp =substr($add[0],0,strlen($add[0])-1);
$id_news = explode("?id=",$id_temp);
$rows[]=$id_news[1];
$rows[] = substr($tit[0],0,strlen($tit[0])-1);
unset($id_news);
unset($add);
unset($tit);
unset($news);
unset($add_temp);
$i++;
}
header('Content-Type: text/xml');
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
echo "<newslist>\n";
for($i = 0;$i < $account-1;$i++)
{
echo "<news id=\"".($i+1)."\">\n";
echo "<title>".$rows[($i)*2+1]."</title>\n";
echo "<articleid>".$rows[2*($i)]."</articleid>\n";
echo "</news>\n";
}
echo "</newslist>";
?>
echo "<title>"这个位置会报错。但是,如果数据来源是数据库而不是网页抓取的话,这个代码没有任何问题。请大神看看如何解决。
这是报的错

这是查看的源码:

