[請益] curl抓取網頁的問題
最近在用PHP寫一個可以抓取"樂透號碼"的程式
這是要抓取的網頁
http://www.taiwanlottery.com.tw/result_all.aspx
但我一直無法抓取到全部的號碼 /_\
以下是我寫的code
<?php
$url = "http://www.taiwanlottery.com.tw/result_all.aspx";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$content = curl_exec($ch);
curl_close($ch);
preg_match('/<td class=number>.*?([\d]+).+?<\/td>/',$content,$target);
preg_match('/<td class=number_special>(.+?)<\/td>/',$content,$result);
echo $target[0];
echo $result[0];
?>
懇請大家替我解惑一下
是正規表示式寫得不好?
還是code本身需要改些什麼?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.115.156.76
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 3 篇):
PHP 近期熱門文章
PTT數位生活區 即時熱門文章