<span
new
=
""
style=
"font-family:Times"
>
function
getFmlDataToDB() {
$link
= mysql_connect ( SAE_MYSQL_HOST_M . ':' . SAE_MYSQL_PORT, SAE_MYSQL_USER, SAE_MYSQL_PASS );
$html
= str_get_html ( GetHtmlCode ( http:
if
(
$link
) {
mysql_select_db ( SAE_MYSQL_DB,
$link
);
mysql_query ( 'set names utf8' );
foreach
(
$html
->find ( 'div[
class
=article block untagged mb15]' )
as
$per
) {
$z
= null;
$t
= null;
$w
= null;
$d
= null;
$p
= null;
$ds
= null;
$ps
= null;
$author
=
$per
->find ( 'div[
class
=author]' );
if
(
$author
!= null) {
$a
=
$author
[0]->find ( 'a' );
$z
=
$a
[1]->innertext;
}
else
{
$z
= 'no author';
}
if
(
$author
!= null) {
$icon
=
$author
[0]->find ( 'a' );
$t
=
$icon
[0]->src->innertext;
}
else
{
$t
= '...............';
}
$content
=
$per
->find ( 'div[
class
=content]' );
$w
=
$content
[0]->innertext;
$vote1
=
$per
->find ( 'div[
class
=stats]' );
$vote2
=
$vote1
[0]->find ( 'span[
class
=stats-vote]' );
$vote3
=
$vote2
[0]->find ( 'i[
class
=number]' );
$d
=
$vote3
[0]->innertext;
$comments1
=
$vote1
[0]->find ( 'span[
class
=stats-comments]' );
$comments2
=
$comments1
[0]->find ( 'a[
class
=qiushi_comments]' );
$comments3
=
$comments2
[0]->find ( 'i[
class
=number]' );
$p
=
$comments3
[0]->innertext;
$up_down
=
$per
->find ( 'div[
class
=stats-buttons bar clearfix]' );
$up_down1
=
$up_down
[0]->find ( 'ul' );
$li
=
$up_down1
[0]->find ( 'li' );
$up
=
$li
[0]->find ( 'span[
class
=number hidden]' );
$ds
=
$up
[0]->innertext;
$down
=
$li
[1]->find ( 'span[
class
=number hidden]' );
$ps
=
$down
[0]->innertext;
}
}
else
{
echo
'数据库链接KO';
}
}</span>