求助~

@Ta 2014-12-07 4003点击
能不能用curl来检测网页特定的内容,如果检测到了就运行另一个文件,像http://dyml.net/User/Register.shtml,这里如果检测到了开放注册了就运行另一个php文件。有没有办法呢?
<?php
$re=0;
$url='http://dyml.net/User/Register.shtml';
$yz=file_get_contents($url);
echo $yz;
if(!strstr($yz,'用户名')){
echo '没有开放注册!!!';
}else{
$re=2;
}
$url2='http://id666.ml/'.$re.'.php';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$output = curl_exec($ch);
if(curl_exec($ch) === false){
    die(curl_error($ch));
}
curl_close($ch);
header('Content-type: text/html; charset=utf-8');
echo $output;
?>
回复列表(11|隐藏机器人聊天)
添加新回复
回复需要登录