如何通过登录页面使用biterScripting捕获页面?

时间:2014-02-19 19:59:08

标签: web-scraping

我要复制的网站(https)需要用户名和密码才能访问该网站。我尝试过Biterscripting,但它只复制登录页面而不是实际的网页。我不确定是否有办法使用脚本输入用户名和密码。

" http://用户名:密码@地址"仍然给我登录页面,而不是实际的网页。

鉴于URL列表,我想将内容复制到文本文件中。

2 个答案:

答案 0 :(得分:1)

我认为您需要像这样使用针对IS(Internet会话)的biterscripting命令。 (要POST到页面,您需要使用'ispost'命令。要获取页面,您只需使用'cat'命令。)

# Declare variables
var str page

# Start internet session, named s, user agent Mozilla.
isstart s "" "Mozilla/5.0"

# If the site is https://www.abc.def, connect to site.
isconnect s "https://www.abc.def" > $page

# The site's index page is in variable $page.
# Suppose the login form is in this format -

# <form name="login" action="login.php" method="post">
# Account: <input type="text" name="login"><
# Password: <input type="password" name="pswd">
# <input type="submit" value="submit">
# </form>

# Login by posting "login=me&pswd=mypassword&submit=submit" to login.php.
ispost s "login.php" "login=me&pswd=mypassword&submit=submit" > $page
# "me" and "mypassword" are values of login and password.

登录后的页面现在位于变量$ page中。我认为这是你正在寻找的页面。

希望这有帮助。

答案 1 :(得分:0)

你用什么语言?

首先,您必须登录,然后检索结果页面。

您可以使用cURL来实现此目的。这里有一个使用cURL和PHP的简单示例:

php curl: I need a simple post request and retrival of page example