<?php
$date
=
date
(
"Ymd"
);
$url
=
"http://top.finance.sina.com.cn/ws/GetTopDataList.php?top_type=day&top_cat=all&top_time="
.
$date
.
"&top_show_num=20&top_order=ASC"
;
$doc
=
file_get_contents
(
$url
);
header(
"Content-Type:text/html;charset=gb2312"
);
preg_match_all('/
"url"
:".*l/U',
$doc
,
$article
);
$article
=current(
$article
);
$rule
=
"/\"url\":(.*)\"\"/"
;
function
OnlyUrl(
$string
){
$string
=
stripslashes
(
$string
);
$string
=
str_replace
('
"url"
:
"',"
",
$string
);
return
$string
;
}
function
GetTitle(
$url
){
$doc
=
file_get_contents
(
$url
);
$rule
=
"/<h1 (.*)<\/h1>/"
;
preg_match(
$rule
,
$doc
,
$result
);
echo
$result
;
}
foreach
(
$article
as
&
$value
){
$value
=OnlyUrl(
$value
);
}
?>