PHP’s cURL (Client URL)

PHP’s cURL (Client URL):

cURL was introduced by Daniel Stenberg in 1997.

It is a command line tool for getting or sending files using URL syntax. It supports a range of 
common Internet protocols, currently including HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, LDAP, 
LDAPS, DICT, TELNET, FILE · IMAP, POP3, SMTP and RTSP.

PHP supports libcurl that allows you to connect and communicate to many different types of servers
with many different types of protocols.

cURL Example (fetch the example.com index.txt page):

<?php
$ch = curl_init("http://www.example.com/"); // initialize a cURL session
$fp = fopen("index.txt", "w");

// Sets an option on the given cURL session handle
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);

curl_exec($ch); // Execute the given cURL session
curl_close($ch); // close a cURL session
fclose($fp);
?>

cURL Functions:

curl_close — Close a cURL session

curl_copy_handle — Copy a cURL handle along with all of its preferences

curl_errno — Return the last error number

curl_error — Return a string containing the last error for the current session

curl_exec — Perform a cURL session

curl_getinfo — Get information regarding a specific transfer

curl_init — Initialize a cURL session

curl_multi_add_handle — Add a normal cURL handle to a cURL multi handle

curl_multi_close — Close a set of cURL handles

curl_multi_exec — Run the sub-connections of the current cURL handle

curl_multi_getcontent — Return the content of a cURL handle CURLOPT_RETURNTRANSFER is set

curl_multi_info_read — Get information about the current transfers

curl_multi_init — Returns a new cURL multi handle

curl_multi_remove_handle — Remove a multi handle from a set of cURL handles

curl_multi_select — Wait for activity on any curl_multi connection

curl_setopt_array — Set multiple options for a cURL transfer

curl_setopt — Set an option for a cURL transfer

curl_version — Gets cURL version information

Post to Twitter Post to Digg Post to Facebook Post to Google Buzz Send Gmail

2 Comments

  1. avatarFaaEV

Leave a Comment

Your email address will not be published. Required fields are marked *