Skip to main content
Inspiring
November 23, 2007
Answered

FMS2 call to PHP

  • November 23, 2007
  • 1 reply
  • 341 views
Hi,

I'm trying to find an example on how FMS2 calls a PHP script with loadvars.sendAndLoad. I'm trying to trigger that event when a users(clients) stream is published from the FMS2. Does anyone have a working example on a call to a PHP script or a tutorial.

Thanks

/A
    This topic has been closed for replies.
    Correct answer zozew
    THX, actually it was a lot simpler then I though server Actionscript Loadvars works almost or precicely as the do on the client side. I'm able now to call a PHP-script and use the onLoad event (on the server side) to trigger events on the client side :)

    /A

    1 reply

    Participating Frequently
    November 26, 2007
    I don't know about loadvars.sendAndLoad, but I have FMS create a gateway connection and connect to an AMFPHP service. I use it for remoting to a database, but you could have your service do whatever you want.

    example…

    application.onAppStart = function() {
    NetServices.setDefaultGatewayUrl(" http://yourserver.com/amfphp/gateway.php");
    this.gatewayConnection = NetServices.createGatewayConnection();
    }
    then when a client connects I do (in application.onConnect):
    newClient.service = application.gatewayConnection.getService("MssqlRemoting", new AMFPHPResult(newClient));

    where MssqlRemoting.php is the name of my services file in the services dir of the AMFPHP install in my webserver root and newCient is the first arg of the application.onConnect function.

    //default responser obj is defined in application root:
    function AMFPHPResult(client) {
    this.client = client;
    }

    then the serveside Client instance can do this:
    this.service.initUsage(args);
    where initUsage is a function in your AMFPHP service.

    and your callback would look like this (in application root):
    AMFPHPResult.prototype.initUsage_Result = function(e) {
    trace(e);
    }

    check out AMFPHP for examples of implementing a service.
    zozewAuthorCorrect answer
    Inspiring
    December 3, 2007
    THX, actually it was a lot simpler then I though server Actionscript Loadvars works almost or precicely as the do on the client side. I'm able now to call a PHP-script and use the onLoad event (on the server side) to trigger events on the client side :)

    /A