「php」cURL学习笔记

说明

 cURL官方义:cURL is a command line tool for transfering data whith URL syntax (使用URL语法传输数据的命令行工具)。

简单示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
/**
*获取百度html页面
*@return string $html
*/
function getHtml()
{
$url = 'http://www.baidu.com'
$ch = curl_init();
curl_opset($ch,CURLOPT_URL,$url);
curl_opset($ch,CURLOPT_RETURNTRANSFER,true);//不打印
$html = curl_exec($ch);
curl_close($ch);
return $html;
}
坚持原创技术分享,您的支持将鼓励我继续创作!
0%