Basic principle...LOGIN

Basic principles of cURL

cURL

curl is an open source file transfer tool that uses URL syntax to work in command line mode. It can obtain various files from the Internet. Various network resources. Simply put, curl is an upgraded version of crawling pages.

The simplest model is the one shown below:

QQ截图20161105153711.png##

<?php
 //1.初始化,创建一个新cURL资源
 $ch = curl_init(); 
//2.设置URL和相应的选项
 curl_setopt($ch, CURLOPT_URL, "http://www.baidu.com/");
 
curl_setopt($ch, CURLOPT_HEADER, 0); 
//3.抓取URL并把它传递给浏览器
 curl_exec($ch); 
//4.关闭cURL资源,并且释放系统资源
 curl_close($ch); 
?>

Preparation for using cURL

Open php.ini

Query curl Is the module turned on?

QQ截图20161105154726.png

If there is no ; sign in front, you only need to remove and save it. Next Section

<?php //1.初始化,创建一个新cURL资源 $ch = curl_init(); //2.设置URL和相应的选项 curl_setopt($ch, CURLOPT_URL, "http://www.baidu.com/"); curl_setopt($ch, CURLOPT_HEADER, 0); //3.抓取URL并把它传递给浏览器 curl_exec($ch); //4.关闭cURL资源,并且释放系统资源 curl_close($ch); ?>
submitReset Code
ChapterCourseware