本文整理汇总了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;未经允许,请勿转载。 |
请发表评论