Hi Sergio,

2010/3/24 sergio_101 <sergiolist@village-buzz.com>
i am currently using HTTPSocket to pull data from a url...

looks like this:

       | data |
       data := String
                               fromByteArray: (HTTPSocket httpGet: anUrl).

the problem here is that HTTPSocket httpGet: '' return a RWBinaryOrTextStream.

To get the string, you need to send the message contents to the stream.

(HTTPSocket httpGet: 'json url') contents

 

i end up with a string that has my desired data (a JSON string), but,
it's preceeded by this:

yes because it's a stream, not a string.

hth, 

Cédrick
 

'a RWBinaryOrTextStream ' '<here is the stuff i need>' ' '

i am trying to lop off the first part by doing:

jsonData := dataString replaceAll:  'RWBinaryOrTextStream' with: 'test'.

just to see if i can touch the string..

but no matter what i do, i can't get any parts of the string to be raplaced..

it almost looks like there are three strings in there..

the RWBinaryOrTextStream one, the one i need, and an empty one..

is there a better way to pull a url?

thanks!


--

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

http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners



--
Cédrick