PHP实现采集程序原理和简单示例代码_php实例

WBOY
Release: 2016-05-17 09:40:24
Original
726 people have browsed it
 
I Believe In Love 
 蓝牙音乐网 - 8391.com 
 蓝牙音乐网 - 8391.com 
 
 
 
 
 

 

确认有用数据: 
歌曲名称:I Believe In Love 
歌手:榭拉 
歌曲路径:http://218.78.213.183:880/daolianmtvfuc__________________kkkkkkkkkk//shela_believe.wmv 
我们在小偷程序中只要得到以上数据就可以了 
3、PHP代码编写 
PHP: 
/******** 
说明,为程序简单化,整个程序没有使用正则表达式 
(我自己对这个方面也很臭,呵呵,高手别骂) 
****/ 
//定义一个函数,对字符简单的过滤 

function str($txt){ 
 $txt= str_replace("'","'",$txt); 
 $txt= str_replace("\"","\\"",$txt); 
 return $txt; 

//初始化程序 
$magic_quotes_gpc = get_magic_quotes_gpc(); 
$register_globals = @ini_get('register_globals'); 
if(!$register_globals ││ !$magic_quotes_gpc) { 
 @extract(daddslashes($HTTP_POST_VARS)); 
 @extract(daddslashes($HTTP_GET_VARS)); 
 if(!$register_globals) { 
 foreach($HTTP_POST_FILES as $key => $val) { 
 $$key = $val['tmp_name']; 
 ${$key.'_name'} = $val['name']; 
 ${$key.'_size'} = $val['size']; 
 ${$key.'_type'} = $val['type']; 
 } 
 } 

if (function_exists('set_time_limit') == 1 && @ini_get('safe_mode') == 0) { 
 @set_time_limit(1000); 

//end 
//为防止日后对方修改地址,把地址前部相同的提取出来 
$host="http://218.78.213.183:880/daolianmtvfuc__________________kkkkkkkkkk/"; 
if(!$action){ 
echo "click here to start"; 
die(); 
}else{ 
$end=3488;//结束ID 
if(!$id││$id$url="http://mtv.8391.com/Yxwen.asp?id=".$id; 
$str=@file_get_contents($url);//读取页面代码 
if($str){ 
//利用关键字符,分割代码 
$a1=explode("value=\"",$str);//value=\"来分割字符 
//取歌手名称 
$n1=explode("\"",$a1[1]); 
$ges=str(trim($n1[0])); 
//取歌曲名称 
$g1=explode("\"",$a1[3]); 
$name=str(trim($g1[0])); 
//取歌曲地址 
 $h1=explode("href=\"",$str); 
$h2=explode("\"",$h1[1]); 
$mtvurl= str(str_replace($host,"",trim($h2))); 
 //添加数据库 
 /******** 
 可根据自己的程序,适当的添加 
 ********/ 
 
} 
$id++; 
if($idcleck here "; 
echo "";} 
elsedie("program runing over"); 

?> 
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!