- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
<?php
class cURL
{
private $handler;
function cURL($url = null)
{
$this->handler = curl_init($url);
}
// Да, я ленивый!
function __call($name, $args)
{
if($name == "init") return;
if(strstr($name, "multi")) die("Multiple cURL not supported in this class.");
$name = "curl_$name";
if(!function_exists($name)) die("Function $name not found.");
array_unshift($args, $this->handler);
$fn = new ReflectionFunction($name);
return $fn->invokeArgs($args);
}
}
Lowezar 02.10.2012 08:54 # +3
rdifb0 02.10.2012 13:46 # +1
В моем идеале должно быть так, curl::factory($url)->param(curl::AUTOREFERER, true)->post(array('foo'=>'bar))->execute();
guest 02.10.2012 16:20 # +1
rdifb0 02.10.2012 18:36 # 0