15 public function __construct($url = null,$return_transfer =
true,$follow_location =
true){
16 if($this->_handle = curl_init($url)){
17 if($return_transfer) $this->returntransfer =
true;
18 if($follow_location) $this->followlocation =
true;
27 if($this->_handle) curl_close($this->_handle);
28 $this->_handle = null;
32 if($this->_constants === null) $this->_constants = \Rsi\Record::get(get_defined_constants(
true),
'curl');
37 if(!$this->_options)
foreach($this->
getConstants() as $name => $value)
38 if(substr($name,0,8) ==
'CURLOPT_') $this->_options[lcfirst(\
Rsi\
Str::camel(strtolower(substr($name,8))))] = $value;
43 if(!$this->_infos)
foreach($this->
getConstants() as $name => $value)
44 if(substr($name,0,9) ==
'CURLINFO_') $this->_infos[lcfirst(\
Rsi\
Str::camel(strtolower(substr($name,9))))] = $value;
48 public function __set($key,$value){
49 if(!array_key_exists($key,$this->
getOptions()))
throw new \Exception(
"Unknown option '$key'");
50 $this->setopt($this->_options[$key],$value);
54 if(!array_key_exists($key,$this->
getInfos()))
throw new \Exception(
"Unknown info '$key'");
55 return $this->getinfo($this->_infos[$key]);
58 public function __call($func_name,$params){
59 return call_user_func_array(
'curl_' . \
Rsi\
Str::snake($func_name),array_merge([$this->_handle],$params));
__construct($url=null, $return_transfer=true, $follow_location=true)
static camel($str, $delimiters=' -_')
Converts a delimited string to CamelCase.
static snake($str, $delimiter='_')
Converts a CamelCased string to snake_case.
__call($func_name, $params)