當前位置: 首頁>>代碼示例>>PHP>>正文


PHP BrowserEmulator類代碼示例

本文整理匯總了PHP中BrowserEmulator的典型用法代碼示例。如果您正苦於以下問題:PHP BrowserEmulator類的具體用法?PHP BrowserEmulator怎麽用?PHP BrowserEmulator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了BrowserEmulator類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: openArxiv

 static function openArxiv($id)
 {
     $be = new BrowserEmulator();
     $be->addHeaderLine("Referer", "http://google.com/");
     $be->addHeaderLine("User-Agent", $_SERVER['HTTP_USER_AGENT']);
     $file = $be->fopen($id);
     // if failed to connect to arxiv.org, try 5 times more.
     for ($i = 0; $i < 5 && !$file; $i++) {
         //sleep(1);
         echo "{$i}...";
         $file = $be->fopen($id);
     }
     if (!$file) {
         return false;
     }
     //$response = $be->getLastResponseHeaders();
     $html = '';
     $line = fgets($file, 4096);
     while ($line != null && $line != '') {
         $html .= $line;
         $line = fgets($file, 4096);
     }
     fclose($file);
     return $html;
 }
開發者ID:nbboob,項目名稱:arxiv,代碼行數:25,代碼來源:BrowserEmulator.php

示例2: openpage

function openpage($rowurl)
{
    $be = new BrowserEmulator();
    $be->addHeaderLine("Referer", "http://www.bibletv.cz/");
    // volani odkud jsi na stranku prisel. pouzij nejakou jejich vychozi stranku.
    $file = $be->fopen($rowurl);
    while ($line = fgets($file, 1024)) {
        $_page .= $line;
    }
    fclose($file);
    if ($_page == "") {
        return FALSE;
    }
    return $_page;
}
開發者ID:johnymarek,項目名稱:xLiveCZ,代碼行數:15,代碼來源:bibletv.php

示例3: openpage

function openpage($rowurl)
{
    $be = new BrowserEmulator();
    $be->addHeaderLine("Referer", "http://www.ceskatelevize.cz");
    // volani odkud jsi na stranku prisel. pouzij nejakou jejich vychozi stranku.
    $be->addHeaderLine("X-Requested-With", "XMLHttpRequest");
    $file = $be->fopen($rowurl);
    while ($line = fgets($file, 1024)) {
        $_page .= $line;
    }
    fclose($file);
    if ($_page == "") {
        return FALSE;
    }
    return $_page;
}
開發者ID:johnymarek,項目名稱:xLiveCZ,代碼行數:16,代碼來源:ct_link.php

示例4: url_open

 function url_open()
 {
     global $be, $path;
     if (!$be) {
         require_once $path['core'] . "BrowserEmulator.class.php";
         $be = new BrowserEmulator();
     }
     if ($this->authUser) {
         $be->authUser = $this->authUser;
     }
     if ($this->authPass) {
         $be->authPass = $this->authPass;
     }
     $file = $be->fopen($this->_info['url']);
     while ($line = fgets($file, 1024)) {
         $line_array[] = $line;
     }
     @fclose($file);
     $line_string = @implode("", $line_array);
     return $line_string;
 }
開發者ID:johnedelatorre,項目名稱:fusion,代碼行數:21,代碼來源:feed.class.php

示例5: __construct

 /**
  * No need to call this.
  * @param string $url URL to open
  * @param Config $iconf Optionally pass in the Config object to use
  */
 public function __construct($url, Config $iconf = null)
 {
     parent::__construct();
     $this->urltoopen = $url;
     if (!$iconf) {
         $iconf = new Config();
     }
     $this->addHeaderLine('Referer', 'http://' . $iconf->imdbsite . '/');
     if ($iconf->force_agent) {
         $this->addHeaderLine('User-Agent', $iconf->force_agent);
     }
     if ($iconf->language) {
         $this->addHeaderLine('Accept-Language', $iconf->language);
     }
 }
開發者ID:riverstore,項目名稱:imdbphp,代碼行數:20,代碼來源:Request.php

示例6: __construct

 /**
  * No need to call this.
  * @param string $url URL to open
  * @param Config $iconf Optionally pass in the Config object to use
  */
 public function __construct($url, Config $iconf = null)
 {
     parent::__construct();
     $this->urltoopen = $url;
     if (!$iconf) {
         $iconf = new Config();
     }
     $this->addHeaderLine('Referer', 'http://' . $iconf->imdbsite . '/');
     if ($iconf->force_agent) {
         $this->addHeaderLine('User-Agent', $iconf->force_agent);
     }
     if ($iconf->language) {
         $this->addHeaderLine('Accept-Language', $iconf->language);
     }
     // Hack us into a session that uses the new layout
     $this->addHeaderLine('Cookie', "session-id=477-7065933-2802665; session-id-time=1607695465");
 }
開發者ID:alfonsor,項目名稱:imdbphp,代碼行數:22,代碼來源:Request.php


注:本文中的BrowserEmulator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。