PHP的curl_init采摘获取内容实例教程

WBOY
Release: 2016-06-13 13:03:56
Original
866 people have browsed it

PHP的curl_init采集获取内容实例教程
// 1. 初始化
$ch = curl_init();
// 2. 设置选项,包括URL
curl_setopt($ch, CURLOPT_URL, "http://www.kekeka.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
// 3. 执行并获取HTML文档内容
$output = curl_exec($ch);
// 4. 释放curl句柄
curl_close($ch);

curl_setopt中的CURLOPT_URL,CURLOPT_RETURNTRANSFER等参数,请参考php文档手册,里面有详细说明!

现在得到$output内容..使用正则表达式匹配出你需要的内容

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