Home > Backend Development > PHP Tutorial > curl的一些小疑点

curl的一些小疑点

WBOY
Release: 2016-06-13 13:11:12
Original
741 people have browsed it

curl的一些小问题
请教一下把一个网页的某部分内容抓取出来是怎么实现的...没有思路....
比如说我想抓取mmcfood.1x.net里面的表格...其他的都不要..

------解决方案--------------------

PHP code
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://mmcfood.1x.net/');
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);
preg_match("#
Copy after login
]*)>(.*?)
#is", $htmls, $matches); echo $matches[0];
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template