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:
##
<?php //1.初始化,創(chuàng)建一個新cURL資源 $ch = curl_init(); //2.設(shè)置URL和相應(yīng)的選項 curl_setopt($ch, CURLOPT_URL, "http://www.baidu.com/"); curl_setopt($ch, CURLOPT_HEADER, 0); //3.抓取URL并把它傳遞給瀏覽器 curl_exec($ch); //4.關(guān)閉cURL資源,并且釋放系統(tǒng)資源 curl_close($ch); ?>
Preparation for using cURL
Open php.ini
Query curl Is the module turned on?
If there is no ; sign in front, you only need to remove and save it.