Example #1
0
 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;
 }
Example #2
0
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;
}
Example #3
0
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;
}
Example #4
0
 /**
  * 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);
     }
 }
Example #5
0
 /**
  * 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");
 }
Example #6
0
 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;
 }