Dan P.
Dan P.

Reputation: 1775

Cross-domain JSON/PHP

I've been studying this matter for a little while and a lot of material is dating from a few years back. Most likely that would work, but I'm wondering what's your take on this today.

Goal: Users should embed something similar to Google Analytics on their websites, which I must use to retrieve and manipulate that information on my own server. Data example: name : "blabla", age : 23, etc.

Most likely JSON in the embed code would be involved (JSONP?), but how about doing it on the server-side so I can start manipulating the data with PHP?

Upvotes: 3

Views: 420

Answers (1)

whereismydipp
whereismydipp

Reputation: 566

Regarding the frontend implementation you can have a look at

Can anyone explain what JSONP is, in layman terms? (very good example)

or

http://en.wikipedia.org/wiki/JSONP#Cross-site_request_forgery (what is the difference between jsonp/json)

If you are talking about a backend implementation:

Have a google search about RESTful Apis. This is the way to go if you consider a flexible implementation serving different kind of responses get the most out of http).

For a PHP implementation have a look at cakePHP for example and how it uses mod_rewrite and the http-protocol to server responses.

How to read json: http://book.cakephp.org/2.0/en/controllers/request-response.html#cakerequest

Thats it in "theory"...

Upvotes: 1

Related Questions