<?php //建立網絡爬蟲 function get_html($url){ $headers = array( "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $content = curl_exec($ch); curl_close($ch); return $content; } //處理網頁,提取關鍵詞 function get_keywords($html){ //正則匹配 //... return $keywords; } //將信息保存在數據庫中 function save_info($url, $title, $keywords){ //寫入數據庫 //... }總的來說,
上一篇baidu php 招聘
下一篇jtbc php模板