There is this website http://www.ingress.com/intel
To access the website, we must login using username and password.
Once accessed, the site uses JSON for its data.
I am new to this JSON thing.
Anyone can give a general example how to get JSON data from a website using Delphi?
I am using Delphi 7 by the way.
Thanks.
I suspect it will be pretty difficult to log in this specific website from a Delphi application.
You will need to log via a Google account, and handle cookies as expected.
Therefore, I'm afraid you won't be able to use any direct Indy / Synapse / ICS / WinINet library to access the data.
You will probably need to embed a full browser within the application, then access to the content from the JavaScript point of view, remoting the browser from your application.
Take a look at those components:
TWebBrowser
(i.e. Internet Explorer) as available in Delphi;Then you will have to parse the JSON content. But you must first ensure that you can login the application!
Those are two questions.
For 1st question there are a lot of libraries, some of those:
InternetReadFile
http://msdn.microsoft.com/en-us/library/windows/desktop/aa385103.aspxFor example this is a sample of getting file from internet: http://synapse.ararat.cz/doku.php/public:howto:httpgetpage
Or another lib's demos (actually every lib has them, loading file from HTTP is so common task...):
As for JSON parsers, after you downloaded content from net, that is a narrower choice: JSON is a relatively recent trend and many JSON parsers heavily use features of Delphi 2009+
Personally i think you'd better try to use JSON parser from mORMot project. That project also has HTTP layer so perhaps you can use their code to read file over HTTP as well.
There are examples or parsing JSON string:
More info at http://synopse.info/ and http://blog.synopse.info/tag/JSON
They also have forum with responsive community.
SuperObject, while originally built around generics (practically working since Delphi 2010), also has Delphi 7 compatibility, though some of its features would not work. See http://code.google.com/p/superobject/wiki/first_steps
And you always can search for more libraries on http://www.torry.net