本文轉錄自
http://www.neo.com.tw/archives/2004_03.html


今天只是突然想試寫看看,沒想到還蠻順利的。

以後就可以在網頁上動態顯示目前的拍賣評價了,Yahoo奇摩拍賣的數字變動,也會反應到網頁上面來,想要這個功能的話,只要把我這段程式改個帳號貼上去就可以囉。(當然如果不是 PHP 就行不通了)

原始程式:


$YahooId = "neo288588"; //Yahoo 的拍賣帳號
$YahooRatingUrl = "http://tw.user.bid.yahoo.com/tw/show/rating?userID="; //Yahoo 的評價連結
$handle = fopen ($YahooRatingUrl.$YahooId, "r");
$contents = "";
do {
$data = fread($handle, 8192);
if (strlen($data) == 0) {
break;
}
$contents .= $data;
} while(true);
fclose ($handle);

$strLeft = ""; //開始判別字串 
$strRight = "

"; //結束判別字串 
$posLeft = strpos($contents, $strLeft);
$posRight = strpos($contents, $strRight, $posLeft);

$YahooBidInf = substr($contents, $posLeft, $posRight-$posLeft);

?>


$YahooBidInf 就是你的「評價」、「信用卡認證」、「手機認證」的資訊,裡面存的是 HTML ,只要在你想顯示的地方加個 就可以了。

當然如果 Yahoo 奇摩拍賣如果變動了這頁的HTML,這個程式「有可能」也因此失效了。
arrow
arrow
    全站熱搜

    backtrue 發表在 痞客邦 留言(0) 人氣()