file_get_contents

file_get_contents改进wordpress 的模板,对关键字的输出。
<?php
set_time_limit(0);
$file = file_get_contents(“neirong.txt”);
 $t = explode(“\r\n”,$file);
 $tnum = count($t)-1;
 for($i=0;$i<100;$i++)
 {
 $neirong = $t[mt_rand(0,$tnum-1)];
 $url=”<a href = ‘http://26836659.blogcn.com‘>.$neirong.</a>”;
echo($url);
echo(“<br>”);
}
?>
<?php
$url_this =  “http://”.$_SERVER [‘HTTP_HOST’];  //获取URL
// echo $url_this;
$ctx = stream_context_create(array(
   ‘http’ => array(
       ‘timeout’ => 1 //设置一个超时时间,单位为秒
       )
   )
);
$file =”$url_this//search.php?type=query&q=$query”; 
$content = file_get_contents($file,0,$ctx); 
//echo $content; 
$array = explode(“\r\n”, $content); 
//print_r($array); 
for($i=0; $i<count($array); $i++) 

  echo $array[$i].'<br />’; 
}
?>

没有评论:

发表评论

Follow Us

FOLLOW US

Blog Archive

Comments

Blogger 提供支持.

Search This Blog

Tags

header ads