Saturday 15 May 2010

delphi - Http get json into string -


I am trying to get a json response through a HTTP GET method for a string but I have found that : Enter image details here

I am using code like: < / P>

  memo1.Text: = idhttp1.Get ('http://blabla.com/bla.php');   

This gives the JSN data I need to get Jason's response to Memo 1.

How can I do this?

I got a solution This code works right.

  Function GetURLAsString (aURL: string): string; Var LHTP: TIDHTP; Alstream: Teestring Stream; Start lHTTP: = TIdHTTP.Create (zero); LStream: = TStringStream.Create (Results); Try lHTTP.Get (aURL, lStream); LStream.Position: = 0; Results: = lStream.ReadString (lStream.Size); After all, free and offline (LHTPP); FreeAndNil (lStream); End; End;    

No comments:

Post a Comment