Stats

540 Contributors: 22 Thursday, May 11, 2017
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap

Using cURL in PHP

Syntax

  • resource curl_init ([ string $url = NULL ] )
  • bool curl_setopt ( resource $ch , int $option , mixed $value )
  • bool curl_setopt_array ( resource $ch, array $options )
  • mixed curl_exec ( resource $ch )
  • void curl_close ( resource $ch )

Parameters

ParameterDetails
curl_init-- Initialize a cURL session
urlThe url to be used in the cURL request
curl_setopt-- Set an option for a cURL transfer
chThe cURL handle (return value from curl_init())
optionCURLOPT_XXX to be set - see PHP documentation for the list of options and acceptable values
valueThe value to be set on the cURL handle for the given option
curl_exec-- Perform a cURL session
chThe cURL handle (return value from curl_init())
curl_close-- Close a cURL session
chThe cURL handle (return value from curl_init())

Related Examples