|
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>Is it possible to use Rebol to download
a web page that is cgi generated? This would >involve logging into a
site with a username and password and then reading the cgi >generated data
into a file.
Yes - it is definitely possible.
Assuming the CGI page has been written to handle
the "GET" method of a form (as opposed to the "POST" method) it's relatively
easy. The real problem comes in where you have to deal with password
protected web pages. I assume you're talking about basic authentication,
where the browser pops up that little dialog box and asks for your username and
password... Depending on how the server is set up, it could be as simple
as this:
request-response: read http://username:[EMAIL PROTECTED]/bin/mycgi.cgi?arg1=x&arg2=y
This would supply the basic auth credentials of
username and password to the site www.site.com
- accessing the /bin/mycgi.cgi script, and handing it the two post variables of
arg1 with a value of x and arg with a value of y.
However, from experience - basic auth rarely goes
so easily. You'll probably find that you have to use the following
method...
request-response: read [
scheme: 'http user: "username" pass: "password" host: "www.site.com" path: "bin/mycgi.cgi?arg1=x&arg2=y" ]
Keep in mind that the path is always from the
root of the website. Also keep in mind that you'll probably need to URL
Encode the path properly to escape special characters used in the arguments to
the script (like replacing spaces with + characters).
Hope this helps.
- Porter Woodward
|
- [REBOL] grabbing web pages jetroy
- woodward
