Пример #1
0
 public static function create($userAgent = self::UA_DEFAULT)
 {
     $client = new Client();
     $client->setOpt('USERAGENT', $userAgent);
     $browser = new Browser($client);
     return $browser;
 }
Пример #2
0
 public function setOpt($name, $value = null)
 {
     if (is_array($name)) {
         foreach ($name as $k => $v) {
             $this->setOpt($k, $v);
         }
         return $this;
     }
     if (is_string($name)) {
         $num = self::$map[Client::getOptToInt($name)];
     } else {
         $num = $name;
     }
     curl_setopt($this->handler(), $num, $value);
 }