PHP头条
热点:

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


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内容..使用正则表达式匹配出你需要的内容

www.phpzy.comtrue/phprm/30569.htmlTechArticlePHP的curl_init采摘获取内容实例教程 PHP的curl_init采集获取内容实例教程 // 1. 初始化 $ch = curl_init(); // 2. 设置选项,包括URL curl_setopt($ch, CURLOPT_URL, "http://www.kekeka.com"); curl_setopt($ch, CURLOPT_R...

相关文章

PHP之友评论

今天推荐