简体   繁体   English

PGBrowser 如何在另一个页面上重定向

[英]PGBrowser How to redirect on another page

I am scraping html data from a website that requires a login.我正在从需要登录的网站上抓取 html 数据。 I am using PGbrowser library.我正在使用PGbrowser库。

After the login, it's redirecting to dashboard, but I want to load another page instead.登录后,它重定向到仪表板,但我想加载另一个页面。 I did not find a solution for redirecting.我没有找到重定向的解决方案。

require 'pgbrowser.php';
$b = new PGBrowser();
$b->useCache = true;

$page = $b->get('https://www.example.com/login.aspx');
$form = $page->form(); // Retrieve form
$form->set('Username', "username");
$form->set('Password', "password");
$page = $form->submit();

You would just do another get:你只会做另一个得到:

$nextpage = $b->get($another_url);

Also you probably don't want the useCache = true line.此外,您可能不想要 useCache = true 行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM