3

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?

3
  • What exactly are you asking? Do you have any failed attempt you can share? Commented Jun 26, 2013 at 1:19
  • I have not attempted any code, still unsure how to go about transfering JSON data from website1/website2/website3... to the master server which retrieves all the data. Commented Jun 26, 2013 at 1:27
  • You can simply add a script tag to the HTML, with the src pointing to your php file, and the data as URL parameters. That's more or less what google analytics does. Commented Jun 26, 2013 at 2:19

1 Answer 1

1

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"...

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, great material to get going.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.