PHP的curl_init采摘获取内容实例教程
Jun 13, 2016 am 11:02 AM
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内容..使用正则表达式匹配出你需要的内容

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to realize the mutual conversion between CURL and python requests in python

Tutorial on updating curl version under Linux!

PHP8.1 released: Introducing curl for concurrent processing of multiple requests

From start to finish: How to use php extension cURL to make HTTP requests

How to handle 301 redirection of web pages in PHP Curl?

Solution to PHP Fatal error: Call to undefined function curl_setopt()
