close
<?
$url = 'http://www.ntust.edu.tw/home.php';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
$html = curl_exec($ch);
echo $html;
?>
短短幾行就可以撈到html , 再寫 parser 取出你想要得部分就好囉
--------------------------------------------------
如果是目標網址是 https 記得要加入
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);
如果目標網址必須POST Data 則要加上
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "Key1=Value&Key2=Value2&.........."); //再改成目標要吃的參數
文章標籤
全站熱搜