本文整理汇总了PHP中BrowserEmulator::fopen方法的典型用法代码示例。如果您正苦于以下问题:PHP BrowserEmulator::fopen方法的具体用法?PHP BrowserEmulator::fopen怎么用?PHP BrowserEmulator::fopen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BrowserEmulator
的用法示例。
在下文中一共展示了BrowserEmulator::fopen方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例4: BrowserEmulator
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;
}