好好学习,东方不败。

做个努力的小伙。

  博客园  :: 首页  :: 新随笔  ::  ::  :: 管理
一般php采集代码能用的到,这里只是简单的实现代码。
  1. <?php   
  2. $title='脚本学堂';   
  3. $hello='jbxue.com!';   
  4. $file=file_get_contents('http://www.jbxue.com');   
  5. $file=iconv("gbk//IGNORE","utf-8",$file);   
  6. //echo $file;   
  7. echo strpos($file,'<title>');   
  8. echo substr($file,strpos($file,'<title>')+7,strpos($file,'</title>'-strpos($file,'<title>')+7));   
  9. $file=str_replace(array('百度一下','{hello}'),array($title,$hello), $file);   
  10. ?>   
小偷程序:

  1. <?php   
  2. function _url($Date){   
  3.     $ch = curl_init();   
  4.     $timeout = 5;   
  5.     curl_setopt ($ch, CURLOPT_URL, "$Date");   
  6.     curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);   
  7.     curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");   
  8.     curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);   
  9.     $contents = curl_exec($ch);   
  10.     curl_close($ch);   
  11.     return $contents;   
  12. }   
  13. $url="http://www.jbxue.com";   
  14. $contents.=_url($url);   
  15. echo $contents; //输出内容   
  16. ?>  
posted on 2014-02-24 07:00  snowfly123  阅读(1037)  评论(0编辑  收藏  举报