HTTP Connections with Smalltalk - VisualWorks 
Author Message
 HTTP Connections with Smalltalk - VisualWorks

Load the HTTP parcel from the $(VISUALWORKS)/net directory and then you can do something like:

    ' http://www.*-*-*.com/ ' asURI
        readStreamDo: [ :stream :headers |
            stream contents ]

HTH,

Martin

--
Martin Kobetic, Cincom Smalltalk Development, http://www.*-*-*.com/

Quote:

> I am writing a project in Smalltalk. In this project I have to read
> the content (source code) of a website which is on another server. In
> Squeak, there is a method to do this.
> HTTPSocket httpShowPage: '[url]'.
> But I didn't find a way to do this in VisualWorks 5i.4. Does anybody
> have a solution or a hint?



Mon, 18 Oct 2004 11:27:43 GMT  
 HTTP Connections with Smalltalk - VisualWorks

HTTPClient getUrl: 'http://www.pinkroccade.com'.

Peter



Quote:
> I am writing a project in Smalltalk. In this project I have to read
> the content (source code) of a website which is on another server. In
> Squeak, there is a method to do this.
> HTTPSocket httpShowPage: '[url]'.
> But I didn't find a way to do this in VisualWorks 5i.4. Does anybody
> have a solution or a hint?



Tue, 19 Oct 2004 00:18:20 GMT  
 HTTP Connections with Smalltalk - VisualWorks
Start with a fresh image
Load Parcel VisualWave 5i.4

copy&paste

| tmp |
tmp := HTTPClient getUrl: 'http://www.pinkroccade.com'.
tmp entityBytes inspect

works for me



Quote:
> I'm sorry, but I wasn't able to get it working. I copied the
> expression in the Transcript and tried to do it. But then the
> unhandled exception was thrown: Message not understood: #getUrl:. I
> looked in the Browser and I didn't find the message "getUrl" to
> HTTPClient. Can you help me?




Quote:
> > HTTPClient getUrl: 'http://www.pinkroccade.com'.

> > Peter



> > > I am writing a project in Smalltalk. In this project I have to read
> > > the content (source code) of a website which is on another server. In
> > > Squeak, there is a method to do this.
> > > HTTPSocket httpShowPage: '[url]'.
> > > But I didn't find a way to do this in VisualWorks 5i.4. Does anybody
> > > have a solution or a hint?



Tue, 19 Oct 2004 17:21:28 GMT  
 HTTP Connections with Smalltalk - VisualWorks
The method you are suggesting is now obsolete and is replaced by HTTP
support in Net Clients. This has much more extensive support of HTTP
client functionality at all levels, including HTTPS. Among other
things there is support for HTTP URLs. URL objects represent a
location and access method (file, ftp, http, etc) and have stream
interface which works more or less uniformly across all transports
protocols. The following will return the content of resource for
files, http and ftp:

" Getting contents of a file "
stream := 'file:///c:\WS_FTP.LOG' asURI readStream text.
contents := [stream contents] ensure: [stream close].

" Get home page of Yahoo "
stream := 'http://www.yahoo.com' asURI readStream.
contents := [stream contents] ensure: [stream close].

" Get index of all internet RFCs "

asURI readStream text.
contents := [stream contents] ensure: [stream close].

Quote:

> Start with a fresh image
> Load Parcel VisualWave 5i.4

> copy&paste

> | tmp |
> tmp := HTTPClient getUrl: 'http://www.pinkroccade.com'.
> tmp entityBytes inspect

> works for me



> > I'm sorry, but I wasn't able to get it working. I copied the
> > expression in the Transcript and tried to do it. But then the
> > unhandled exception was thrown: Message not understood: #getUrl:. I
> > looked in the Browser and I didn't find the message "getUrl" to
> > HTTPClient. Can you help me?



> > > HTTPClient getUrl: 'http://www.pinkroccade.com'.

> > > Peter



> > > > I am writing a project in Smalltalk. In this project I have to read
> > > > the content (source code) of a website which is on another server. In
> > > > Squeak, there is a method to do this.
> > > > HTTPSocket httpShowPage: '[url]'.
> > > > But I didn't find a way to do this in VisualWorks 5i.4. Does anybody
> > > > have a solution or a hint?



Tue, 19 Oct 2004 22:52:42 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. US - FL - S.E.****VISUALWORKS/SMALLTALK/VISUALWORKS/SMALLTALK****CONTRACT

2. ST VisualWorks- Smalltalk, VisualWorks and Envy

3. VW 5i.4 HTTP Connection

4. http connections, url drag and drop

5. HTTP connection without a browser

6. HTTP connection-alive and threading

7. http-client connection with keep-alive?

8. Tcl http requests for keep-alive, persistent connections.

9. http connection via proxy server

10. R: http connection via proxy server

11. Socket timeouts for HTTP connections (httplib)?

12. Ingress - VisualWorks/Wave connection under NT

 

 
Powered by phpBB® Forum Software