我只想取得google網頁上2002股票數據方框
可是不知為什麼就是無法跑出來
是我哪裡寫錯了?
請各位程式高手幫幫忙~~~
<?php
header("Content-Type: text/html; charset=big5");
$url = "
https://www.google.com.tw/search?newwindow=1&biw=1280&bih=908&q=2002&oq=2002&gs_l=serp.3..0l10.226330.226946.0.227234.4.4.0.0.0.0.83.276.4.4.0....0...1c.1.31.serp..0.4.276.pbIQyeh6GVI";
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_USERAGENT, "Bee-ma");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERAGENT, "Google Bot");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
//在需要用戶檢測的網頁里需要增加下面兩行
//curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
//curl_setopt($ch, CURLOPT_USERPWD, US_NAME.":".US_PWD);
$contents = curl_exec($ch);
curl_close($ch);
preg_match('/<li[^>]*class="mod g tpo knavi obcontainer"[^>]*>(.*?)<\/li>/Ui',$contents,$match);
$title = $match[1];
echo "$title<BR>";
?>