| 14.1 The fetch Statement | |
The <fetch> statement, given a URL, fetches that page on the Web and returns it:
<SCRIPT LANGUAGE=vortex>
<A NAME=main PUBLIC>
<FORM METHOD=post ACTION="$url/">
Enter a Url: <INPUT NAME=page SIZE=40 VALUE="http://">
<INPUT TYPE=submit VALUE="fetch">
</FORM>
<IF $page neq "">
<H2>Here's the link text</H2>
<fetch $page>
<rex ROW "<a=[^>]+>\P=!</a>*" $ret>
$ret <BR>
</rex>
</IF>
</A>
</SCRIPT>
|
This script asks for a URL $page , and then uses <fetch> to contact that web server and obtain the page. <rex> is used in a loop to scan the raw HTML for the anchor text of hyperlinks. (The looping syntax of <rex> was added Sep. 24 1999.)
When we run this script against Thunderstone's home page, we get the following (next page):
| Back: Processing Data from the Web | Next: The fetch Statement - Continued |