Home > php教程 > php手册 > php curl_init 与 curl_setopt函数

php curl_init 与 curl_setopt函数

WBOY
Release: 2016-06-13 11:17:24
Original
1618 people have browsed it

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);
?>


Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template