Rebol-Net-GTK

Author: pat665
Date: 27-juin-2004

Contents

1. Introduction

2. 4003-Reading email with POP3

3. 4004-How to get the domain of an url

4. 4005-HTTP referer

5. 4001-Browsing html file

6. 4002-Drudgereport news one-liner


1. Introduction

This is a collection of "good-to-know" information about Rebol in regard to Internet programming. Some are mine, most are from the Rebol-List, books or articles about Rebol.

2. 4003-Reading email with POP3

How do I read a POP account if an "@" is a part of the username like this ?

>username: carlos@revistaeletronica.com.br
>pass: "password"
>server: mail.revistaeletronica.com.br

I cannot do the following :

>>read pop://carlos@revistaeletrica:password@mail.revistaeletronica.com.br

ANSWER

mailbox:  [
  scheme: 'pop
    host: " mail.revistaeletronica.com.br "
    user: "carlos/revistaeletrica" 
    pass: "password"
]

messages: read mailbox

The way you set up user may depend on your service provider, uncertain.

3. 4004-How to get the domain of an url

How to get the domain of an url?

ANSWER

finally I will use 'parse to get the domain URL.

>> u: http://www.rebol.net/cookbook/index.html
>> parse u [thru "http://" to "/" stop: to end (print copy/part u (index? stop) - 1 )]
http://www.rebol.net
== true

4. 4005-HTTP referer

I need a way of getting the REFERER of a URL in my CGI. Any help?

ANSWER

referer: select system/options/cgi/other-headers "HTTP_REFERER"

Note: use (in a test CGI)

print replace/all mold system/options/cgi newline

to see all the header fields,

5. 4001-Browsing html file

How to browse an HTML file?

ANSWER

set-browser-path %explorer.exe
browse %index.html

6. 4002-Drudgereport news one-liner

foreach x remove-each x load/markup http://drudgereport.com [
    any [ tag? x not find x "..." find x "drudge"]
    ][
    print x
]

or

print remove-each x load/markup http://drudgereport.com  [
    any [tag? x not find x "..." find x "drudge"]
]

Document generated with Rebol.
Original code from Carl Sassenrat modified by pat665,
REBOL and the REBOL logo are trademarks of REBOL Technologies.