asUrl retrieveContents -> with POST vars

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

asUrl retrieveContents -> with POST vars

sergio_101
i know i have done this before, and it's totally escaping me..

i am also not sure if this is the place to ask generic smalltalk
questions, so if it's not, please someone let me know..

doing something like:

url := 'http://domain/?var1=one&var2=two"

url asUrl retrieveContents contents.

BUT!

i would like to send the vars as POST vars. can i do that with retrieveContents?

thanks!

--
----
peace,
sergio
photographer, journalist, visionary

http://www.ThoseOptimizeGuys.com
http://www.CodingForHire.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101

Reply | Threaded
Open this post in threaded view
|

Re: asUrl retrieveContents -> with POST vars

Sean P. DeNigris
Administrator
Browsing Url I found #postFormArgs:.

Checking the code for #retrieveContents, and tracing the execution, I ended up at #retrieveContentsArgs:accept:, which calls HTTPSocket class>>httpGetDocument:args:accept:request:

Contrast to #postFormArgs:, which calls HTTPSocket class>>httpPostDocument:args:accept:request:

The magic of Smalltalk tools!

HTH,
Sean
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: [SPAM] asUrl retrieveContents -> with POST vars

Sven Van Caekenberghe
In reply to this post by sergio_101
Or you could do this, which is a more explicit API, with more object oriented computing going on behind the scenes:

ZnHttpClient new
        url: 'http://localhost:1701/echo/foo';
        parameterAt: 'foo' put: 'bar';
        parameterAt: 'baz' put: 'bang';
        post.

Sven

PS: For this you need an extra install:

Gofer it
  squeaksource: 'ZincHTTPComponents';
  package: 'Zinc-HTTP';
  package: 'Zinc-Tests';
  load


On 17 Dec 2010, at 21:53, sergio_101 wrote:

> i know i have done this before, and it's totally escaping me..
>
> i am also not sure if this is the place to ask generic smalltalk
> questions, so if it's not, please someone let me know..
>
> doing something like:
>
> url := 'http://domain/?var1=one&var2=two"
>
> url asUrl retrieveContents contents.
>
> BUT!
>
> i would like to send the vars as POST vars. can i do that with retrieveContents?
>
> thanks!
>
> --
> ----
> peace,
> sergio
> photographer, journalist, visionary
>
> http://www.ThoseOptimizeGuys.com
> http://www.CodingForHire.com
> http://www.coffee-black.com
> http://www.painlessfrugality.com
> http://www.twitter.com/sergio_101
> http://www.facebook.com/sergio101
>