Sina news thieves
1.
<HTML>
<Head>
<Meta http-equiv = "refresh" content = "60">
<Meta HTTP-EQUIV = "Pragma" content = "no-Cache">
<Meta http-equiv = "Content-Type" content = "text/html"; charset = "?????? ">
<Title> Sina _ news captureProgram</Title>
</Head>
<Body>
<Center> </center>
<?
$ Host = "127.0.0.1"; // MySQL Host Name
$ Namesql = "???? "; // MySQL user name
$ Passsql = "???? "; // MySQL password
$ Lib = "news"; // Database Name
$ Table = "news"; // database table name
$ Filename = "http://news.sina.com.cn/news1000/index.shtml"; // capture the news page
$ Keytop = "Start of News"; // keyword of start of news
$ Keybottom = "End of News"; // keyword of end of news
$ Conn = mysql_connect ($ host, $ namesql, $ passsql );
Mysql_select_db ($ Lib, $ conn );
$ Fp = fopen ($ filename, "r", 1 );
$ Flag = 0; $ add = ""; $ found = 0; $ end = 0; $ I = 0; $ temp [4] = "";
While (! $ End = 1 ){
While (! $ Flag = 1 ){
$ Word = fgetc ($ FP );
$ Add = $ Add. $ word;
If ($ WORD = '<' and strlen ($ add) = 1) {$ flag = 0 ;}
If ($ WORD = '<' and strlen ($ add )! = 1) {$ flag = 1; $ add = substr ($ add, 0, strlen ($ add)-1 );}
If ($ WORD = '>') {$ flag = 1 ;}}
If (strchr ($ add, $ keytop) {$ found = 1 ;}
If (strchr ($ add, $ keybottom) {$ found = 0; $ end = 1 ;}
If (strchr ($ add, '<') = true and strchr ($ add, 'href ') = true) or strchr ($ add,' <') = false) and $ found = 1) {$ text [$ I] = $ add; $ I ++ ;}
If ($ WORD = '<' and $ flag = 1) {$ add = $ word; $ flag = 0;} else {$ add = ""; $ flag = 0 ;}}
Fclose ($ FP );
For ($ I = 1; $ I <sizeof ($ text)-1; $ I + = 5 ){
$ Temp [1] = $ text [$ I + 1]; $ temp [2] = $ text [$ I + 2]; $ temp [3] = $ text [$ I + 3]; $ temp [4] = $ text [$ I + 4];
$ Ins = "select * from $ table where title = '$ temp [3]'";
$ List = mysql_query ($ INS, $ conn );
@ $ COUNT = mysql_num_rows ($ list );
If ($ COUNT = 0 ){
$ Ins = "insert into $ table (type, URL, title, date) values ('$ temp [1]', '$ temp [2]', '$ temp [3]', '$ temp [4]') ";
$ List = mysql_query ($ INS, $ conn );}}
Mysql_close ($ conn );
?>
</Body>
</Html>
2. <?
$ Handle = fopen ("http://news.sina.com.cn/news1000/", "R ");
$ Sign = 0;
While (! Feof ($ handle ))
{
$ Message = fgets ($ handle, 512 );
If ($ Sign = 1)
{
Print ("$ message ");
}
If (ereg ("News start", $ message, $ result ))
{
$ Sign = 1;
}
Else if (ereg ("End of news", $ message, $ result ))
{
$ Sign = 0;
}
}
Fclose ($ handle );
?>