去百度提问 老审核不过  所以来来这里问下专业人士 了   希望各位帮我下 谢谢比如 我这个代码是这样的<?php
$a2="&page=18#";
$url = $_GET['url'];
$url1 = $url.$a2;
$lines = file("$url1");
foreach ($lines as $line_num => $line) {
echo "Line <b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";
}
?>获取了一段网页的html代码
代码中有很多行下列这种  我想要让他把我不需要的过滤了再显示出来Line 173 : <td>15<input type="hidden" id="domain15" value="huoju.icoke.qq.com" /></td> 
Line 174 : <td class="blue t_l"><a href="http://huoju.icoke.qq.com" target="_blank">huoju.icoke.qq.com</a></td> 
Line 175 : <td class="blue t_l" id="title15">正在获取中……</td> 
Line 176 : <td style="text-align:center"><div class="pr-outer"><iframe scrolling="no" frameborder="0" src="http://www.aizhan.com/ajaxAction/getpr.php?from=linkche&domain=huoju.icoke.qq.com&key=9447fdc0b0261a3f32dc50e7b4142ee0" marginwidth="0" marginheight="0" style="border: 0 none" id="prframe"></iframe></div></td> 需要让他只显示比如huoju.icoke.qq.com  这些   取from=linkche&domain=和&key=  中间包含的这些网站   或者<input type="hidden" id="domain15" value="   " /></td>   中包含的网站    就是需要一段php代码来起个过滤作用 

解决方案 »

  1.   


    $str = <<<html
    Line 173 : <td>15<input type="hidden" id="domain15" value="huoju.icoke.qq.com" /></td>
    Line 174 : <td class="blue t_l"><a href="http://huoju.icoke.qq.com" target="_blank">huoju.icoke.qq.com</a></td>
    Line 175 : <td class="blue t_l" id="title15">正在获取中……</td>
    Line 176 : <td style="text-align:center"><div class="pr-outer"><iframe scrolling="no" frameborder="0" src="http://www.aizhan.com/ajaxAction/getpr.php?from=linkche&domain=huoju.icoke.qq.com&key=9447fdc0b0261a3f32dc50e7b4142ee0" marginwidth="0" marginheight="0" style="border: 0 none" id="prframe"></iframe></div></td>
    html;preg_match_all('/\&domain=(.*)\&key=/is', $str, $match);
    if (isset($match[1])) {
        print_r($match[1]);
    }Array
    (
        [0] => huoju.icoke.qq.com
    )
      

  2.   


    我不懂php   麻烦把我把你这段代码和上面的一起  谢谢 
      

  3.   

    foreach ($lines as $line_num => $line) {
    $str.= "Line <b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";
    }preg_match_all('/\&domain=(.*)\&key=/is', $str, $match);
    if (isset($match[1])) {
        print_r($match[1]);
    }