[Newbies] Building the equivalent of wget in Squeak

Benjamin Schroeder benschroeder at acm.org
Mon Aug 21 19:07:20 UTC 2006


Hi Andy,

> I would like to create a simple means of getting the contents of a  
> web page, in the same way that wget works.  What I hoped to do was  
> something like:
>
> wget url: 'http://...' show.
>
> I found a few classes e.g. Httpurl and also the asUrl method of the  
> string class, but I can't quite work out how to put it all  
> together.  As it seems like a simple way to start learning Squeak,  
> I wonder if someone could point me in the right direction.

You can use something like

	(HTTPClient httpGet: 'www.google.com') contents

to get the text of a web page. Just using

	HTTPClient httpGet: 'www.google.com'

gives you a "stream" over the page's text.

You can browse HTTPClient's class side to see how the method works  
and start digging deeper.

Hope this helps,
Benjamin Schroeder



More information about the Beginners mailing list