Home >Backend Development >PHP Tutorial >PHP webpage interception news code_PHP tutorial

PHP webpage interception news code_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-14 10:09:33941browse

function Get_news($url,$count)

{
$handle = fopen($url,"r"); 
$c = 0;
while(($line = fgets($handle,1024)) && ($c<$count))
{
//$ptr2= "/(.*)/";

$ptr= "/(.*)/";
 
preg_match_all($ptr,$line,$str,PREG_SET_ORDER);
if($str)
{
$res[$c]= strip_tags($str[0][2]);
//$res[$c][1] = $url."admin/view_n.php?id=".$str[0][1];
$c = $c+1;
 
 
}
print_r($res[$c]);
}
return $res;
}
 
 
 
 
$url = "http://stu.gdmc.edu.cn/";
$count = 7;
//echo"
";</div>
<div>$result=Get_news($url,$count);</div>
<div> </div>
<div>    foreach ($result as $key => $value) {</div>
<div>    echo iconv("gb2312", "UTF-8", $value)."<br/>";//</div>
<div>    }</div>
<div> </div>
<div> </div>
<div>//print_r(Get_news($url,$count));</div>
<div>//echo"
";
?> 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/477644.htmlTechArticle?php function Get_news($url,$count) { $handle = fopen($url,r); $c = 0; while(($line = fgets($handle,1024)) ($c$count)) { //$ptr2= /a href=\/html/xiaonaxinwen(.*)(.*)/a/; $ptr= /...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn