Exemplo n.º 1
0
 public function __construct($name, $type = NULL)
 {
     $this->curl = curl::app('http://www.kinopoisk.ru/');
     $this->curl->setReferer('http://www.kinopoisk.ru/')->setUagent()->setHeader()->setHeaders(array('Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language' => 'ru,en-us;q=0.7,en;q=0.3', 'Accept-Charset' => 'windows-1251,utf-8;q=0.7,*;q=0.7', 'Keep-Alive' => '300', 'Connection' => 'keep-alive'));
     $this->search_name = $name;
     $this->doc = phpQuery::newDocument(self::getPage($this->search_name, $type), "text/html; charset=windows-1251");
     $this->img = $this->doc->find('.film-img-box a img')->attr('src') ? base64_encode(file_get_contents($this->doc->find('.film-img-box a img')->attr('src'))) : base64_encode(file_get_contents("http://st.kp.yandex.net/images/persons/photo_none.png"));
     if ($this->page_id[1] == 'name') {
         $this->GetArtistInit();
     } elseif ($this->page_id[1] == 'film') {
         $this->GetFilmInit();
     } else {
         echo "Ничего не найдено";
     }
 }