=== Top of the Swiki === Attachments ===
Recipe: Grabbing a Page from the Web
Problem
You want to get a web page for which you have the URL.
Solution
"Output a Web page on the Transcript window"
| mimeDoc |
mimeDoc := 'http://www.squeak.org/' asUrl retrieveContents.
Transcript show: mimeDoc content.
Discussion
asUrl takes a string and converts it to an URL. URLs are represented as concrete subinstances of Url (one for each protocol). retrieveContents asks a Url to retrieve its contents and return a MIMEDocument. A MIMEDocument contains the actual data along with a MIME content-type; content will return the data.
For more details, browse classes Url and MIMEDocument in the system.
See also