<?php
$url = "http://www.heroone.com/ems.php";
$r = file_get_contents($url);
//echo $r;//if(preg_match_all("/<TABLE(.*)<\/TABLE>/U",$r,$array))
if(preg_match("/<TABLE style=\"PADDING-LEFT: 8px; LINE-HEIGHT: 23px\" cellSpacing=1 cellPadding=0
width=700 bgColor=#a5d2eb border=0>(.*)<\/TD><\/TR><\/TBODY><\/TABLE>/",$r,$array))
{
echo $array[1]."\n";
}
else
{
echo "Not Found!\n";
}
?> 如上,为什么取不到<TABLE style=\"PADDING-LEFT: 8px; LINE-HEIGHT: 23px\" cellSpacing=1 cellPadding=0
width=700 bgColor=#a5d2eb border=0>(.*)<\/TD><\/TR><\/TBODY><\/TABLE>和<\/TD><\/TR><\/TBODY><\/TABLE>之间的内容?
$url = "http://www.heroone.com/ems.php";
$r = file_get_contents($url);
//echo $r;//if(preg_match_all("/<TABLE(.*)<\/TABLE>/U",$r,$array))
if(preg_match("/<TABLE style=\"PADDING-LEFT: 8px; LINE-HEIGHT: 23px\" cellSpacing=1 cellPadding=0
width=700 bgColor=#a5d2eb border=0>(.*)<\/TD><\/TR><\/TBODY><\/TABLE>/",$r,$array))
{
echo $array[1]."\n";
}
else
{
echo "Not Found!\n";
}
?> 如上,为什么取不到<TABLE style=\"PADDING-LEFT: 8px; LINE-HEIGHT: 23px\" cellSpacing=1 cellPadding=0
width=700 bgColor=#a5d2eb border=0>(.*)<\/TD><\/TR><\/TBODY><\/TABLE>和<\/TD><\/TR><\/TBODY><\/TABLE>之间的内容?
回楼上的再看仔细,有TBODY标签。
$url = "http://www.heroone.com/ems.php";
$r = file_get_contents($url);
//echo $r;
if(preg_match("/<table width=\"700\" border=0 bgcolor=\"#a5d2eb\" cellpadding=\"0\" cellspacing=\"1\" style=\"padding-left:8px; line-height:23px;\">(.*)<\/table>/i",$r,$array))
{
echo $array[1]."\n";
}
else
{
echo "Not Found!\n";
}
$str='<div id="blogname">亮亮的博客<div id="blogTitle">';
preg_match_all("/<div id=\"blogname\">(.*)<div id=\"blogTitle\">/",$str,$arr);
print_r($arr);?>改成这样了还是不行!
preg_match_all("/\<div id=\"blogname\">(.*?)\<div id=\"blogTitle\">/",$str,$arr);
print_r($arr);
<?php
$url = "http://www.heroone.com/ems.php";
$r = file_get_contents($url);
//echo $r;
if(preg_match("/ <table width=\"700\" border=0 bgcolor=\"#a5d2eb\" cellpadding=\"0\" cellspacing=\"1\" style=\"padding-left:8px; line-height:23px;\">(.*) <\/table>/i",$r,$array))
{
echo $array[1]."\n";
}
else
{
echo "Not Found!\n";
} ?>是这一段,哪个有没有没影响
$r = file_get_contents($url); preg_match_all("/\<tr bgcolor=\"#ffffff\" height=\"23\">(.*?)\<\/tr>/", $r, $matches);
var_export(($matches));
preg_match("/<head>(.*)<\/head>/",$r,$array)
取不到内容而
preg_match("/<title>(.*)<\/title>/",$r,$array)
可以取到<title>和</title>之间的内容
var_export(($matches));