Can you help to write a single page of the PHP collection program, and attach an example
For example, I want to collect this page: http://news.163.com/12/0613/20/83TJ7PA700014JB6.html
Requirements:
Collect title
Collect text
Thank you!
------Solution--------------------
First go to http://simplehtmldom.sourceforge.net/index.htm (click Download latest Version Form sourceforge.) To download a Simple_html_ dom.php, fool-style regular, another official online has a detailed tutorial, it is easy to read.
PHP code
header ("content-type:text/html; charset=gb2312 "); require dirname (__file__). '/simple_html_dom.php '; $ch = Curl_init (); curl_setopt ($ch, Curlopt_url, ' http://news.163.com/12/0613/20/ 83tj7pa700014jb6.html '); curl_setopt ($ch, Curlopt_returntransfer, 1); curl_setopt ($ch, curlopt_useragent, ' Mozilla/ 5.0 (Windows; U Windows NT 6.1; En-us; rv:1.9.1.2) gecko/20090729 firefox/3.5.2 GTB5 '), $htmls = Curl_exec ($ch); Curl_close ($ch); $html = str_get_html ($HTMLS); foreach ($html->find (' #h1title ') as $title) {echo strip_tags ($title). '
';//title}foreach ($html->find (' #endText ') as $content) {echo strip_tags ($content);//body}
------ Solution--------------------
PHP to get a list of QQ mailbox friends:
------Solution--------------------
Use crawl page, the title is between the title tag, Body is between body, use regular to remove some unwanted content