[Pharo-project] [COTDC] 3 - HTTPClient

Francisco Ortiz Peñaloza patchinko at gmail.com
Sun Feb 6 20:25:04 CET 2011


It would be great to ilustrate post usage as well and delete class
method #examplePostArgs

I'm a facade for doing simple HTTP GET/POST operations like
downloading / uploading some content.

For example, I get HTML content for http://www.pharo-project.org web
page like this:

       HTTPClient httpGet: 'http://www.pharo-project.org'.
       HTTPClient httpGetDocument: 'http://www.pharo-project.org'.

Or, i can make a post request to http://www.pharo-project.org and send
data to the server like this:

        args := Dictionary new.
	args
		at: 'arg1' put: #('val1');
		at: 'arg2' put: #('val2').
	result := HTTPClient httpPostDocument: 'http://www.pharo-project.org'
args: args.

When successful, a Stream respectively a MIMEDocument is returned, in
case of error, a String is returned.

On Sun, Feb 6, 2011 at 5:03 PM, Sven Van Caekenberghe <sven at beta9.be> wrote:
>
> On 06 Feb 2011, at 18:23, laurent laffont wrote:
>
> > I'm a facade for doing simple HTTP GET/POST operations like downloading / uploading some content.
> >
> > For example, I get HTML content for http://www.pharo-project.org web page like this: HTTPClient httpGet: 'http://www.pharo-project.org'.
>
> I'm a facade for doing simple HTTP GET/POST operations like downloading / uploading some content.
>
> For example, I get HTML content for http://www.pharo-project.org web page like this:
>
>        HTTPClient httpGet: 'http://www.pharo-project.org'.
>        HTTPClient httpGetDocument: 'http://www.pharo-project.org'.
>
> When successful, a Stream respectively a MIMEDocument is returned, in case of error, a String is returned.
>
>




More information about the Pharo-project mailing list