已掉线,重新登录

首页 > 绿虎论坛 > 历史版块 > 编程 > PHP > 源码

标题: 采集笑话源码

作者: @Ta

时间: 2014-04-07

点击: 1334

php

貌似需要先建立joke.txt不然错误提示

<?php
#采集笑话函数
function joke(){
for($i=0;$i<3;$i++){
$u="http://m.kxin.cc/view.asp?id=21934";
$f=file_get_contents($u);
preg_match_all("/view\.asp\?id=(\d+)/",$f,$j);
$p=$j[1][4];
$_u="http://m.kxin.cc/view.asp?id=$p";
$_f=file_get_contents($_u); 
$c=explode("标题:",$_f);
$c=explode("view",$c[1]);
$nr=str_replace("<br/>","\r\n",$c[0]);
$nr=str_replace("href=","",$nr);
$nr=str_replace("<","",$nr);
$nr=str_replace("a","",$nr);
$wd=$nr."|";
$fpt=fopen("joke.txt","a+");
$ff=file_get_contents("joke.txt");
if(!strstr($ff,$nr)){
fwrite($fpt,$wd,strlen($wd));
 
}}
}
joke();

[隐藏样式|查看源码]


『回复列表(1|隐藏机器人聊天)』

1. 竟然没有fclose。。。无爱。。
(/@Ta/2014-04-07 15:35//)

回复需要登录

9月22日 16:18 星期一

本站由hu60wap6驱动

备案号: 京ICP备18041936号-1