Home  >  Article  >  php教程  >  php curl_init 与 curl_setopt函数

php curl_init 与 curl_setopt函数

WBOY
WBOYOriginal
2016-06-13 11:17:241543browse

php curl_init 与 curl_setopt函数  

curl_init
( PHP 4中“ = 4.0.2 , PHP 5中)

curl_init -初始化一个卷曲会议

描述
资源curl_init ( [字符串$网址=零值] )
初始化一个新的会议,并返回一个卷曲处理用于curl_setopt ( ) , curl_exec ( ) ,和curl_close ( )函数。

参数

网址
如果提供, CURLOPT_URL选项将被设置为它的价值。您可以手动设置使用curl_setopt ( )函数。


返回值
返回一个卷曲处理的成功,虚假的错误。

实例

例如# 1初始化一个新的卷曲会议和获取一个网页

// create a new cURL resource
$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://www.111cn.cn/");
curl_setopt($ch, CURLOPT_HEADER, 0);

// grab URL and pass it to the browser
curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);
?>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php filegroup 函数Next article:php fgetcsv 函数