Javascript(Jquery) -> PHP(same domain) -> flash -> PHP(same domain) -> PHP(remote server)
Ever had to make so many calls to display a simple flash object?
It was saturday and I was enjoying the leisure of being at home. When I got a call from an old prospective client. It was an emergency and deliveries had to be made the very night. It had something to do with Ning. Though I have never worked on ning before, the idea of doing a cross-site script sounded like fun! The client wanted a block within Ning to pass user data two ways to a flash object. The bottle neck is, the block understands only HTML. Ths was fixed using javascript to load a PHP using AJAX request. The PHP file being in the same server as Ning had access to the user’s session using Ning’s API. Then the PHP script rendered the flash object injecting the appropriate variables using query string. The second bottle neck was this, the flash script has to pass values to a php script that saves something in a database. We couldnt use mysql_connect as those libraries were not available in the ning server. So we had to call an external PHP script in another server which can manipulate DB. Another bottleneck, when I realized flash has security restrictions on calling scripts from other site. Time for php proxy :)
So in the end the complete flow looked like the following
Javascript(Jquery) -> PHP(same domain) -> flash -> PHP(same domain) -> PHP(remote server) -> MYSQL
The whole experience was so exciting that I am writing this, just a few minutes after completion :)
I remember this incident. :)
how can we call php file or implement php code in ning. if you have sample code available, pl provide