Dcard API 蠻好運用的,不過短時間大量使用是會被鎖的!
直接拿來寫新的Dcard頁面似乎也不難 (?)
A. 取得文章 – https://www.dcard.tw/_api/posts/{PID}
B. 分類看板總覽 – https://www.dcard.tw/_api/forums/{category}/posts
GET變數:熱門文章 – popular=true、取得{PID起的文章} – before={PID}
function getiZO($url){
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$output = curl_exec($ch);
	curl_close($ch);
	$getDC = json_decode( $output );
	for ($j=0; $j<30; $j++) {
		$id = $getDC[$j]->id;
		for ($i=0; $i<10; $i++) { //每篇最多10張圖
			$pic = $getDC[$j]->media[$i]->url;
			if (!$pic) {break;}
			echo "<a href='https://www.dcard.tw/f/{category}/p/".$id."'><img src='".$pic."' height='300px;'></a>";
		}
	}
}
因為單純想試試,所以Code的部分就沒有去做太多的調整囉 ( 欸
