English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

Usage and Examples of PHP curl_exec() Function

PHP CURL Reference Manual

(PHP 4 >= 4.0.2, PHP 5)

curl_exec — Execute a CURL session

Syntax

mixed curl_exec ( resource $ch )

Execute the given CURL session.

This function should be called after initializing a CURL session and all options have been set.

Parameter

ch

The CURL handle returned by curl_init().

Return Value

Returns TRUE on success, or FALSE on failure. However, if the CURLOPT_RETURNTRANSFER option is set, the function returns the execution result on success, and FALSE on failure.

Online Examples

Get a web page

<?php
// Create a CURL resource
$ch = curl_init();
// Set the URL and corresponding options
curl_setopt($ch, CURLOPT_URL, "http:")//www.oldtoolbag.com/");
curl_setopt($ch, CURLOPT_HEADER, 0);
// Fetch the URL and pass it to the browser
curl_exec($ch);
// Close the CURL resource and release the system resources
curl_close($ch);
?>

PHP CURL Reference Manual