Posted By

alexwilliams on 01/01/07


Tagged

php flash remoting


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

willcodeforfood
JimiJay


PHP: Connecting Flash to a Database (remoting)


 / Published in: PHP
 

  1. /* /flashservices/services/Catalog.php */
  2. class Catalog {
  3. var $products_array = array();
  4.  
  5. // Constructor: Contains the list of methods available to the gateway
  6. function Catalog() {
  7. $this->methodTable = array (
  8. "getProducts" => array (
  9. "description" => "Get list of products",
  10. "access" => "remote",
  11. "arguments" => "" // arguments could be optional, not tested
  12. )
  13. ); // end methodTable
  14. }
  15.  
  16. function getProducts() {
  17. // your code goes here
  18.  
  19. return $this->products_array;
  20. }
  21. }
  22.  
  23.  
  24. #include "NetServices.as"
  25. NetServices.setDefaultGatewayUrl("http://yourserver.com/flashservices/gateway.php");
  26. gw = NetServices.createGatewayConnection();
  27. CatalogREMOTE = gw.getService("Catalog", this);
  28. CatalogREMOTE.getProducts();
  29.  
  30. getProducts_Result = function(result) {
  31. _root.products_results = result;
  32. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: alexwilliams on July 28, 2009

It's necessary to setup AMFPHP on yourserver.com in /flashservices/

http://sourceforge.net/projects/amfphp/files/#files

You need to login to post a comment.