Amfphp 1.9 beta - Get it now

Posted on Saturday 16 December 2006

* Update: a second beta is now available here *

Well I've been working on the new version of amfphp for about a week now, and it's ready for a test-drive. I've had the feedback I needed from the alpha, and I am fairly convinced this new version works like a charm. You can download it here. This time it should work with PHP4.

What's new

  • AMF3 support, including RemoteObject. You can finally use it in Flex 2.
  • JSON support. In addition to gateway.php, there is now json.php which allows you to use your services in JSON as well Flash. Two examples here: MochiKit and Spry. XML-RPC also supported. Details below.
  • A new Service Browser. Try it live here. Notice that the samples.MochiTest service is the same one used by the JSON sample, so you can verify for yourself that indeed it works both in AMF and in JSON mode. Fuggawesome.
  • The end of $this->methodTable. From now on, $this->methodTable is ignored. All methods are remotely accessible by default. Details below.

Getting it running in Flex 2

This has nothing to do with amfphp per-say, but to get RemoteObject running, you need to configure the Flex compiler by doing the following:

  • In you source folder, create the services-config.xml file. Paste this in (You can change the uri of the endpoint if you wish):

<?xml version="1.0" encoding="UTF-8"?>
<services-config>
    <services>
        <service id="amfphp-flashremoting-service"
                 class="flex.messaging.services.RemotingService"
                 messageTypes="flex.messaging.messages.RemotingMessage">

            <destination id="amfphp">
                <channels>
                    <channel ref="my-amfphp"/>
                </channels>
                <properties>
                    <source>*</source>
                </properties>
            </destination>
        </service>
    </services>

    <channels>
        <channel-definition id="my-amfphp" class="mx.messaging.channels.AMFChannel">
            <endpoint uri="http://localhost/amfphp/gateway.php" class="flex.messaging.endpoints.AMFEndpoint"/>
        </channel-definition>
    </channels>
</services-config>
 

  • Right-click your project in Flex Builder 2 in the Navigator, go to Flex Compiler, and add -services "services-config.xml" to Additional compiler arguments. Press OK.
  • You can override the gateway location in RemoteObject if you want by setting the endpoint property in the MXML. This is good as you have to clean your project in order for changes to services-config.xml to be caught by the compiler, which means rebuild from scratch. Also, that XML file is painful to look at compared to good old mxml.

About JSON support

Before people start crying about feature bloat, let me put things in perspective. There are two files in the json directory, totaling 5k. That's it. Amfphp has had a JSON parser in it since amfphp 1.2 (the PEAR version, for the service browser), so it didn't need a lot to get it to support JSON.

How it works: To make a request, call /json.php/com.mypackage.MyClass.myMethod/arg1/arg2 (and so on for other arguments). arg1 or arg2 can be strings with or without surrounding quotes, numbers, arrays or objects in JSON format. The myMethod method will be called in class MyClass in the services/com/mypackage folder, with arguments arg1 and arg2 (decoded). Then you can send back whatever you want and it will serialize automatically. If you use NetDebug::trace it will add that in a comment before the actual data. It will serialize recordsets like amfphp does by creating an object which has two keys: "columns" (an array) and "rows" (an array of arrays). You can then easily manipulate this data in JavaScript. If you want to use it with Spry, you can see my example jsondataset.js file which does all the job for you (if anybody at Adobe is listening, you can add it or something along the lines of it in the next version of Spry). If you add POST data to your request it will be deserialized as JSON and you will receive it as the last argument to your method.

Now, why would you use JSON in amfphp instead of, say, library X? Well:

  • You can use the same service in JavaScript AND Flash.
  • You can use the service browser to test your classes.
  • Most PHP Ajax libraries mix and match code and presentation in a fashion which makes me sick to the stomach. Amfphp provides a clean way to organize your code and dispatch calls.
  • It will use PHP's json_* functions if it finds them (built-in in PHP 5.2, available as an extension in older versions), or will revert to PEAR JSON if it doesn't, so you have an easy upgrade path if you need more speed.
  • It will serialize recordsets directly.
  • It doesn't have any JavaScript dependencies, so you can use with whatever toolkit you like (prototype, MochiKit, Spry, you name it).

(I would also say personally that it's entirely fuggawesome, but I think I've already made a pretty strong argument for that).

About XML-RPC support

XML-RPC is similar to SOAP except that it doesn't rely on those godforsaken .wsdl files. It's a lot more verbose that JSON-RPC or AMF-RPC but it's readable, and if you enable gzip compression it's not that bad as far as size goes. It could be useful if you want to share your awesome new service with XML-heads. It requires the xmlrpc extension to be installed. Just call xmlrpc.php through POST and it should work like you expect it to (that is, it uses the same kind of mapping as the "normal" amfphp does, it'll serialize recordsets, etc.)

About the new Service Browser

The new Service Browser rocks. Try it out here if you like. A thing I want to point out is that if you have a fatal error in your service file, it will catch it and not NetConnection.Call.BadVersion on you. That's because it's writing and reading its own amf packets and will do some sanity checking (try calling HelloWorld.triggerAFatalError). It will also show NetDebug::trace output in the "trace" tab, despite this not being supported by RemoteObject for some reason (again, because it's reading and writing it's own amf packets). That being said, the non-test calls are routed through the regular RemoteObject so if there is any discrepancy between my code and the one the player outputs it should be caught early.

If your service uses session you WILL need to use the service browser in a web browser that accepts cookies as I have yet to figure out how to make it honor AppendToGatewayUrl headers.

I need you help with the service browser. I want it to be better, but I don't have that much time, so here's my laundry list, the source is right here, please comment if you're interested in taking on these items.

  • Clean up the current spaghetti-code mess
  • Add Code Generation
  • Make util/MethodTable smarter so it will catch more comments related to a function
  • Show all JavaDoc tags in the service description, not just the param and returns tags.
  • Format HTML properly when encountered
  • Make the Tree view work for any and all objects
  • Make the DataGrid view work when a RecordSet is nested inside something else
  • Make it look better

About $this->methodTable

It's gone for good. The single most annoying thing about amfphp has now been removed. All methods in classes of the service folder are now remotely callable by default. You can make a method non-remote by starting it with an underscore (same as with CakePHP), or by making it private or protected (PHP5 only). You can stop a method from being called (for example, for lack of proper credentials) by creating a beforeFilter($methodName) method and returning false to stop the call (same as with CakePHP, again).

_authenticate support has been temporarily removed (can be done with beforeFilter now), and pageable recordsets have been temporarily disabled as well. New methodologies will be introduced for these features in amfphp 2.0 final.

About recordsets

Currently, only mysql recordsets work. Since amfphp serializes about a dozen different recordset types normally, and I have made a bunch of changes, I will wait until everything is stable before re-enabling the other recordset types. If you need support for those types now, you can rewrite core/shared/adapters/dbnameAdapter.php, using mysqlAdapter.php as a guide.

Acknowledgments

This release would not have been possible without all the hard work of several people who I have borrowed code and ideas from. Big thanks to Zoltan of Fluorine (AMF3 code), Evert of SabreAMF (RemoteObject code), Karl of Charles debugging proxy (debugging needs), Kevin of ServiceCapture (first reverse-engineered AMF3), Aral Balkan for his suggestion of a Flex-based service browser, Renaun Erickson for his PHP4 array_search patch and VO handling code, the people at CakePHP for some of the JSON code, the people at PEAR::JSON, and Christophe Herreman for his original MethodTable class which is now the core of the Service Browser component.


1061 Comments for 'Amfphp 1.9 beta - Get it now'

  1.  
    John
    12/16/2006 | 10:12 pm
     

    Thanks Patrick and everyone who has been involved with AMFPHP. It just gets better and better. I really like the new Flex service browser.

  2.  
    12/17/2006 | 9:28 am
     

    Tks Patrick, tu assures ;)

  3.  
    12/17/2006 | 12:21 pm
     

    This is the best gift for this christmas!! Thanks Patrick!

  4.  
    asai
    12/17/2006 | 1:49 pm
     

    Thanks so much, Patrick and crew.

    You guys are really helping to make open source a reality. Brilliant.

  5.  
    Nicklas
    12/17/2006 | 5:06 pm
     

    Great work I love AMFPHP :-)

  6.  
    Dan
    12/18/2006 | 1:29 am
     

    awesome stuff. i really like the new service browser. i keep getting an error though in flex that its unable to open the ’services-config.xml’ after i set it up in the flex compiler additional arguments. ive tried to do a clean build and bunch of other variations with no luck. i know its something simple but i would appreciate any help

  7.  
    Brett
    12/18/2006 | 10:49 am
     

    Dan,

    I was having the same problem. I was able to fix it by putting the entire path to the file in the compiler argument. ie. -services “C:\Path\to\flex\project\services_config.xml”

  8.  
    diamondtearz
    12/19/2006 | 6:08 pm
     

    Great work Patrick. I love AMFPHP!
    I have a quick question. How do I send an object into the test in the service browser?

  9.  
    12/19/2006 | 6:09 pm
     

    Use {"myVar":"myValue"} notation as in JSON to send objects.

  10.  
    12/20/2006 | 5:04 am
     

    Great xmas present this. thanks. If im converting an AS2 project to AS3, can i just drop this on the server side now, and let the App work pretty much as before?

  11.  
    12/20/2006 | 7:39 am
     

    […] Patrick released a huge update to Amfphp a few days ago. I only just got the chance to play with it and it looks awesome. The new JSON support is perfect for a little somethin’ somethin’ I’m working on and the new Flex-based service browser has great potential. I especially like how the JSON support is backwards compatible with the slower PHP-based JSON parser as well as the new C-based parser in PHP 5.2.0. […]

  12.  
    12/20/2006 | 8:06 am
     

    Great work as always, Patrick. I’m going to make time to look at the service browser in the coming days.

  13.  
    Locke
    12/21/2006 | 11:32 am
     

    First of all let me say the new version KICKS ASS :)
    updating the methodtable was a pain …..

    There is a little matter which isn’t working (or i’m too stupid)’:
    In AMFPHP 1.2 Setting gateway.php : $gateway->setCharsetHandler(”iconv”, “ISO-8859-8″, “CP1255″); enabled me to use Hebrew charset . However in 1.9 this same config doesn’t work , namely every charter that is in Hebrew isn’t displayed where English is displayed
    Just fine .

    Is this a beta thing …. or am i onto a bug here ??

  14.  
    12/21/2006 | 11:36 am
     

    Yes, charset handling is probably broken for databases…I am looking into ways of solving the issue in an unobstrusive way. Stay tuned.

  15.  
    Locke
    12/21/2006 | 12:05 pm
     

    Cool , thanks for the quick response ….. be happy to assist in testing

  16.  
    diamondtearz
    12/21/2006 | 12:29 pm
     

    Thanks Patrick

  17.  
    12/27/2006 | 2:35 pm
     

    http://docs.google.com/View?docid=dskpkt4_326cdgh9x
    I put together a simple layout of the new 1.9 in case anyone else could use something like this. My next step is to convert this whole thing to a Postnuke Applet… love me some amfphp!

  18.  
    12/27/2006 | 6:06 pm
     

    Fun! Okay, I can help on two laundry list items for Service Browser - styling/clean up, and code template generation. I’ve done a couple mods of the AS3 template that’s floating around, I’m happy with them, so hit me up if you’d like to see/hear.

  19.  
    zACK
    12/31/2006 | 4:19 am
     

    love it :)

  20.  
    Ernie
    12/31/2006 | 3:52 pm
     

    Bug in AMFSerializer::writeAmf3Bool
    Should be:
    function writeAmf3Bool($d)
    {
    $this->writeByte( $d ? 0×03 : 0×02);
    }

    0×03 is true and 0×02 is false. This was reversed in the beta you posted.

  21.  
    1/2/2007 | 3:47 pm
     

    Really cool update. i am using strict AS3.. I actually do conect and call functions with AS3. But i am stuck with credentials. Can you please give an exampe for the new way of authenticate.
    Thanks
    Ali

  22.  
    T-Bloch
    1/3/2007 | 12:38 am
     

    Don’t get me wrong - Patrick’s work is fuggawesome to be sure. I’ve just started using the old AMFPHP (actually CakeAMFPHP) with Flex 2 through NetConnection. That combination seems to work fine although it’s less elegant than it could be. I’m trying to figure whether to move to AMFPHP 1.9 beta. My three questions are:

    1. What’s RemoteObject got that NetConnection don’t? (Please say paging)

    2. Can CakeAMFPHP still work somehow with AMFPHP 1.9? (Please say yes)

    3. OK, just two questions then…

    Sank-yoo,

    • Blochy
  23.  
    1/3/2007 | 11:29 am
     
    1. RemoteObject is mostly syntactic sugar. But it’s nice to be able bind events directly in MXML instead of doing everything in ActionScript, everything is centralized and it’s easier to see what’s going on.

    2. Yes, CakeAmfphp will work with amfphp 1.9, but not the current version you have installed. You can check out the new version of CakeAmfphp which supports amfphp 1.9 using SVN and your CakeForge account here:

    https://svn.cakeforge.org/svn/cakeamfphp/amfBB/

  24.  
    Eric
    1/4/2007 | 2:20 pm
     

    “To make a request, call /json.php/com.mypackage.MyClass.myMethod/arg1/arg2 (and so on for other arguments)”

    I had problems with this, as my server assumed json.php was a directory name and quickly returned a 404 - page not found.

    By calling like this instead, I got the expected response.

    /json.php?com.mypackage.MyClass.myMethod/arg1/arg2

  25.  
    Marko Beljan
    1/5/2007 | 3:37 pm
     

    Patrick, this is awesome man. Thank you so much

  26.  
    1/7/2007 | 3:33 am
     

    Eric, what server are you using?

  27.  
    1/7/2007 | 3:35 am
     

    Thanks Ernie, will be fixed in the next version.

  28.  
    T-Bloch
    1/7/2007 | 10:50 am
     

    Thanks Patrick. RemoteObject is a bit nicer - possibly worth the initial trouble. So, hence my third question:

    1. It seems from this example:

    http://www.sephiroth.it/tutorials/flashPHP/flex_remoteobject/

    that Flex Data Services(FDS) is a co-requisite to using RemoteObject. Is FDS really necessary and does its presence mean we’ll get paging functionality?

    Yours one-track-mindedly,

    • Blochy

    P.S. Apologies if this is beyond scope…

  29.  
    1/7/2007 | 10:52 am
     

    No, FDS is not a corequisite at all. I will contact Allessandro about that. Thanks for letting me know.

  30.  
    Eric
    1/8/2007 | 10:15 am
     

    Apache 2.0.46
    PHP 4.3.2

  31.  
    1/8/2007 | 10:16 am
     

    I see, I’ve only tested in Apache 1.3 do far. I’ll try and support both configurations in the future.

  32.  
    1/9/2007 | 3:56 am
     

    Excellent! I love AMFPHP!

  33.  
    1/10/2007 | 2:37 am
     

    […] More information can be found at AMFPHP and 5 1/2. […]

  34.  
    dan
    1/10/2007 | 11:39 am
     

    I’m a total Flex Noobie, so this might be painfully obvious to everyone else, but after spending a few days to figure all this out I thought I’d post on the off chance that it will help some other poor soul ; )

    I had set up AMFPHP on a LAMP testing server running behind a router/LAN and had worked out how to populate a datagrid with a MySQL Dataset via PHP 5 and AMFPHP (not rocket science I know: like I said Total Noob). However when I tried using the exact same PHP page with a Remote Object in Flex using the new 1.9 Beta AMFPHP it didn’t deserialize the Recordset correctly (in fact there’s no such thing as a recordset in Flex…they use an ArrayCollection in it’s place).

    In order to get the data into the datagrid I did the following:

       [Bindable]
        private var myData : ArrayCollection;
    
        private function resultHandler( event:ResultEvent ):void
        {
           myData  = new ArrayCollection(ArrayUtil.toArray(event.result.source));
         }
    

    The old function in Flash was:

        private function resultHandler( event:ResultEvent ):void
        {
           root.myDataGrid.dataProvider = RecordSet(event.result);
         }
    

    I’m not sure why you now need to add “source” at the end of “event.result” and convert it to an array first but, again, hopefully this will save someone else a little hair-pulling : )

    Also whereas in Flash I could just test the swf on the local machine when using Flex I needed to add a cross domain xml file to my server’s webroot…I’m guessing this is because when Flash compiles a swf it’s as a standalone whereas when Flex compiles it produces the HTML and launches it in a browser … I only realized this was why nothing worked when I double-clicked a new flex-built swf on my desktop (rather than recompiling it yet again) and it suddenly did something (not what I wanted it to, mind you, but SOMETHING).

    OK, I’ll stop my babbling now and just close by saying: Thank you for all your hard work on this; I can’t wait to see AMFPHP 2.0 !

  35.  
    1/10/2007 | 11:58 am
     

    To get amfphp to recognize that it should be sending ArrayCollection instead of RecordSet, it needs to detect AMF3 in the message, because the second byte (version) in the AMF message is unreliable for reasons unknown. The surefire way to make sure AMF3 data is sent is to use the RemoteObject tag. If you use NetConnection directly, then Flex might send only AMF0 data if you use only primitive types in your request (amf3 is a superset of amf0).

  36.  
    1/10/2007 | 2:01 pm
     

    can you please provide an example for authenticate under 1.9 beta. how can i send the credentials (AS3 only if possible) also how can i use cakephp style beforeFilter for authenticate.

    Thanks
    Ali

  37.  
    James Gardiner
    1/14/2007 | 9:44 am
     

    HI,
    I would also like more examples of the different ways to utilise this under flex.
    as mx objects and pure AS3. Also security.
    I would really appreciate it,
    Thanks,
    James

  38.  
    michael
    1/15/2007 | 3:05 am
     

    Hello,

    I’m curious if anyone has this running with Flash 9?

    Flex is not helpful for what I’m trying to do, I got amfphp working with Flash 8 it was great but is it the RemoteObject process makes Flash 9 out of the question for now???

    Thanks for the advice,
    Michael

  39.  
    Andrew
    1/15/2007 | 5:31 am
     

    Hi, I’m a new user to flex 2 and would like to try this out but I keep getting the following error when following the instructions above.

    Configuration error encountered on line 2, column 6: ‘The processing instruction target matching “[xX][mM][lL]” is not allowed.’

    I have created the services.config.xml and added the additional argument in the compiler settings in the project properties panel:

    -locale en_US -services “services-config.xml”

    Can you help?

    thank, Andrew

  40.  
    Andrew
    1/15/2007 | 5:34 am
     

    Sorry - typo…

    It is a services-config.xml that I created as in the instructions.

  41.  
    1/16/2007 | 10:33 am
     
  42.  
    T-Bloch
    1/16/2007 | 10:52 am
     

    Patrick,

    By way of follow-up, I was able to get CakeAMFPHP working with amfphp 1.9 beta - so thanks! RemoteObject is now grabbing data from AMFPHP like it’s going out of style! I’ve now installed FDS (although it’s not needed for plain old data grabbing) in the hopes of getting paging working. I’ve seen the post where you’re looking to get FDS-style functionality built into AMFPHP - that will be sweet when it’s available. In the meantime, are there any good resources on how to get AMFPHP working through FDS?

    Thanks Again,

    * Blochy
    
  43.  
    1/16/2007 | 12:48 pm
     

    I’m not sure what you mean by getting amfphp working through FDS, as it doesn’t really make any sense. Amfphp and FDS are both middleware, and you basically choose one or the other. FDS has a larger feature set than amfphp, so I’m looking at ways of integrating FDS features in amfphp, the rationale being that although FDS is nice, it requires either Java or ColdFusion knowledge (two languages I am not particularly fond of), and it requires some server-side stuff to be installed, which doesn’t sit well with shared hosts and the like. Basically, the barrier to entry to FDS is a bit too steep IMHO, so if we could offer a subset of the FDS features in amfphp I think everybody would be happy. We’re working on it, though don’t expect it in amfphp 2.0, it will likely be available later.

  44.  
    1/20/2007 | 3:10 pm
     

    Awesome! But I have to repeat Ali Tan Ucer’s already-twice-repeated question: how do you retrieve credentials information using beforeFilter($methodName)? With _authenticate($userid, $pass) the information was simply passed in as arguments, but I guess now there must be some other (static? global?) way of retrieving it?

    Thanks!

  45.  
    T-Blotch
    1/23/2007 | 7:49 pm
     

    Somehow I though piping the output of AMFPHP to FDS would allow me to take advantage of FDS’ paging capabilities. If you can’t tell already, I’d vote for paging in an upcoming AMFPHP release. I know that’s easier said than done though, so I remain patient and thankful for your incredible work thus far.

    On the topic of VO’s, this http://amfphp.org/docs/classmapping.html explains how to return typed VO’s to Flash. But CakeAMFPHP expects models to be in the ‘models’ directory. Is it possible to return typed VO’s using CakeAMFPHP?

  46.  
    1/23/2007 | 8:40 pm
     

    About CakeAMFPHP typed VOs, I really don’t know, you might be better off asking a question about that on their forums. As for FDS features, it’s not that I don’t want to, but I don’t have the specs for FDS and I don’t have time to do the reverse engineering myself. If you want to help out, please join us on the Universal Remoting list, here:

    http://osflash.org/mailman/listinfo/universalremoting_osflash.org

  47.  
    T-Blotch
    1/24/2007 | 8:59 am
     

    OK, I though that might be off topic a bit. I’ve joined the list - thanks!

  48.  
    _mauro_
    1/26/2007 | 12:41 pm
     

    Hi, will AMFPHP work with old AS2/PHP4 classes ?

  49.  
    Bhavin
    1/27/2007 | 12:14 am
     

    Hi Guys,

    First and foremost, just amazing work you are doing here. Thanks a lot. Now to the problem. I have installed amfphp 1.9 beta with Flex 2 on a windows xp with IIS, php and mysql all running and working fine (without flex apps). I downloaded the HelloWorld example and tried to run that and see how all of these technologies work together (ie. Flex, amfphp 1.9 and php). Even with the simple helloworld example, i could not get it to work. This is what i get when i try to run the flex project under IE and Firefox:

    code:
    Client.Error.MessageSend

    Message:
    Send failed

    Detail:
    Channel.Connect.Failed error NetConnection.Call.BadVersion:

    I have been trying to fix this since the last 2 days and am pulling my hair out now…so much in pain that i cannot get this to work properly. Things that i have taken care of:

    Installed Flex 2.0 with amfphp 1.9
    PHP Version 5.2.0
    I also have put the services-config.xml file with the

    which points to the amfphp 1.9 gateway.php file and checked that i have put
    -locale en_US -services “c:\program files\adobe\flex builder 2\services-config.xml” under the Flex compiler under the project properties.
    Have also checked whether or not the rpc.swc is under FLEX BUILD PATH -> LIBRARY PATH

    I think that’s all that i have to do to make it run and it just doesn’t seem to work. Any help would be much appreciated as for the last two days i have been scouring the net so that i can find a resolution but alas in vague.

    Much much appreciated for all your work and effort and a special shout out goes out to the guys who are the developers for amfphp.

    Thanks guys.

  50.  
    Bhavin
    1/27/2007 | 2:26 am
     

    Got it working now…

    Was the location of the services folder, by default it’s $gateway->setBaseClassPath(”services/”);
    all i did was change it to
    $gateway->setBaseClassPath(”./services/”);
    and oh also put a session_start(); at the start in gateway.php

    Thanks anyways for amfphp, just getting my hands dirty, but i know i am going to just love it…

  51.  
    Anonymous
    2/9/2007 | 10:07 am
     

    Hi.
    This is really great material.

    But sadly I’m using resin querqus (Java implementation of PHP5) and this is not working on it….

    Any clues on how can i make this run on resin?

    I think that this is not running because querqus in not yet fully implemented, so, putting this to run on it would be a major blast..

    Thanks

  52.  
    stefan
    2/10/2007 | 7:04 am
     

    Hi,
    many thanks for the new version.

    How can I solve the charset handling problems? In the Service Browser I get correctly:
    [1] (Object)#2
    geom = “POINT(2600543.00992557 5698212.70880025)”
    strassen = “Ahornstraße”
    strassenstrschl = “35002″
    but my application and the NetConnection Debugger shows
    …..[1] (object #4)
    ……….geom: “POINT(2600543.00992557 5698212.70880025)”
    ……….strassen: “Ahornstra�”
    ……….strassen
    strschl: “35002″

    with no support of german ‘Umlaute’ this version is not usable for mee.
    Any hints?

    Thanks
    Stefan

  53.  
    2/11/2007 | 10:45 pm
     

    At First ,amfphp1.9 Demo is very good
    but
    after exercising the two examples,
    here,I find use amfphp1.9 to send args hard(or i’m very stupid)

    Flex 2

    private function getRecord(p,pageSize):void {
    if (p == undefined) {
    p = curPage;
    }
    myservice.getOperation(’getRecord’).send()
    }

    The problem: How to send the args?
    I want amfphp1.9 like before to send args

  54.  
    2/12/2007 | 7:52 am
     

    Well, I didn’t write RemoteObject, Adobe did, so you can complain to them if you like. You can simply use myservice.getRecord(c) to send an argument (you don’t need to use getOperation, but it will be useful to use it if you want to do data binding on arguments, something which I am not very fond of).

  55.  
    2/12/2007 | 7:53 am
     

    Stefan,

    Save your php file (or your database) as Unicode.

  56.  
    2/12/2007 | 9:04 am
     

    Thanks very much !
    With your help ,I know how to do data binding on args.

  57.  
    stefan
    2/12/2007 | 10:44 am
     

    Changing my database to UTF-8 solved the charset problems.

    I solved two additional problems with
    change core/shared/util/Headers.php
    from //return $headers[$key];
    to return isset($headers[$key]) ? $headers[$key] : NULL;

    and add
    var $gzipCompressionThreshold = 30100; //initialize $gzipCompressionThreshold
    to Gateway.php

    Many, many thanks

    Stefan

  58.  
    stefan
    2/12/2007 | 11:10 am
     

    Sorry,
    changing the database to utf-8 solved only the charset problems from database content. Other content returned from my php-scripts (they are in utf-8) has charset problems
    If I turn off the native extension I have no charset problems with the other content, but now with my database (cause converted to utf-8). So, still in need of a solution.
    Thanks
    Stefan

  59.  
    Lucas
    2/13/2007 | 9:22 am
     

    And what about AMFPHP not running on resin?

    Any solutions?

    Thanks

  60.  
    2/13/2007 | 11:39 am
     

    Lucas,

    If you figure out a way to make it run in Resin and send me a patch, I will definitely add it to the core, but I definitely won’t try to make it run myself, as I have a lot of other priorities.

  61.  
    Lucas
    2/13/2007 | 5:00 pm
     

    Ok. I thougth that maybe there was already a solution. In my last search i found that xml rpc is not yet implemented on quercus… maybe that’s the answer I was looking for.

    Thanks

    by the way… great work you’re doing here!!

  62.  
    adrian
    2/19/2007 | 12:35 pm
     

    Hello ,

    I downloaded the source package from http://www.5etdemi.com/uploads/servicebrowser.zip .
    I tried to run the ServiceBrowser inside Flex Builder but seems that a class is missing , RawAmfService . Does anyone know where to find this one so we can be able to compile the project in Flex Builder ?

    Great work btw.

    Thanks in advance.

  63.  
    adrian2
    2/19/2007 | 6:25 pm
     

    I’m trying to replace 1.2 with 1.9 on a PHP5.1.4 server and its not working. I get this error

    
    Fatal error: Uncaught exception ‘VerboseException’ with message ‘Cannot modify header information - headers already sent by (output started at ….amfphp/services/SessionHandler.php:1)’ in ….amfphp/core/amf/app/Gateway.php:187
    Stack trace:

    0 ….amfphp/core/amf/app/Gateway.php(187): amfErrorHandler(2, ‘Cannot modify h…’, ‘/mnt/Target01/3…’, 187, Array)

    1 ….amfphp/gateway.php(152): Gateway->service(’Content-type: a…’)

    2 {main}

    thrown in ….amfphp/core/amf/app/Gateway.php on line 187

    “….amfphp” is used to in place of the full url path

    Do I have to change the services scripts to get 1.9 to work?

  64.  
    adrian2
    2/19/2007 | 6:26 pm
     

    ooops, some funny formatting in that post!

  65.  
    adrian2
    2/20/2007 | 4:14 pm
     

    This bug I mentioned above was caused by a space character after the closing “?> ” and also the UTF BOM being added by SEPY to the PHP files.. Might not strictly be a bug but never been an issue before. Seems 1.9 is much stricter about formatting

    My scripts work now, but am getting a few issues on some requests. Haven’t time to work them all through so will stick to 1.2 as it works faultlessly and maybe try again on next release. I have started using 1.9 on a new site and it seems fine there.

    Thanks

  66.  
    Kun Janos
    2/23/2007 | 8:00 am
     

    Hi Patrick.

    I’m searching all over the internet but I can’t find an example or description on how the beforeFilter($methodName) is used for authentification. Could you post a few lines on what should we do on Flex and on AMFPHP 1.9? I have amfphp 1.9 beta 2.

    Thanks

  67.  
    2/24/2007 | 10:11 am
     

    Hi,
    I’m trying to get a simple HelloWorld to work, but keep getting the following whenever I run the swf in the browser after defining a RemoteObject:

    Error: Cannot assign operations into an RPC Service (protocol)
    at mx.rpc::AbstractService/http://www.adobe.com/2006/actionscript/flash/proxy::setProperty()
    at SAHelloWorldTest/::RemoteObject1i()
    at SAHelloWorldTest$iinit()
    at SAHelloWorldTestmxmanagersSystemManager/create()
    at mx.managers::SystemManager/::initializeTopLevelWindow()
    at mx.managers::SystemManager/::docFrameHandler()

    This might be something really dumb on my side, but I can’t seem to figure out anything wrong.

    Help!!

  68.  
    Alex
    2/25/2007 | 11:44 pm
     

    This is friggin awesome. I’m pumped for the complete release.

  69.  
    Eric
    2/27/2007 | 2:34 pm
     

    Patrick, regarding my comment earlier about the URL format…I didn’t have AcceptPathInfo on for the directory in my apache conf. Enabling that allowed apache’s “lookback” feature and resolved the problem.

  70.  
    3/9/2007 | 4:09 pm
     

    Hi..

    I’m getting a NetConnection.Call.BadVersion error even If I have no services available. Is it normal? Actually I’m afraid my server has disabled some PHP function the Flex Services Browser might need for security reasons, I don’t know. What do you think?

  71.  
    3/13/2007 | 4:46 am
     

    […] click=”myservice.getOperation(’getList’).send();” AMFPHP 1.9 содержит много изменений, что позволяет корректно работать с flex2/Data services. Вы можете узнать больше о новых релизах и обо всех новых возможностях и изменениях здесь. Помните, что в статье рассмотрена только бета-версия amfphp2 и многие вещи могут измениться в будущем (надеемся, что будет реализована полная поддержка всех возможностей Flex Data Services 2). […]

  72.  
    Ross MacLachlan
    3/18/2007 | 2:41 pm
     

    In response to 2dsms (above)

    Try:

    private function getRecord(p,pageSize):void {
    if (p == undefined) {
    p = curPage;
    }
    myservice.getOperation(’getRecord’).send(p);
    }

    I think send() takes an array though, try p as a string, array or object. Make sure you test a method with a few parameters as there is some documentation about specifying the order required by your remote method.

    You can find out more in the documents (though this one is hard to find).

    The only reason I do it this way is that I do not know the service name (passed as param). My code would look like

    myRemoteObject.getOperation(remoteMethod).send(args);

    Its working for me in 1.9 b2

  73.  
    3/20/2007 | 4:28 pm
     

    To: Sameer Ahuja
    I had the same error.
    It seems that the protocol-attribute of the triggers this.
    I removed it and it works fine.

  74.  
    3/30/2007 | 6:47 am
     

    try p as a string, array or object

  75.  
    Sajid Hussain
    4/3/2007 | 6:52 pm
     

    Hi …..
    First of all nice work Nice Work ..
    Well I want one suggestion I have been with .net and Flash Remoting but if what I am going to use amfphp1.9+ZendFramework+mysql ?
    will it allow Paging? ORM kinda thing

  76.  
    4/5/2007 | 12:18 am
     

    […] click=”myservice.getOperation(’getList’).send();” AMFPHP 1.9 содержит много изменений, что позволяет корректно работать с flex2/Data services. Вы можете узнать больше о новых релизах и обо всех новых возможностях и изменениях здесь. Помните, что в статье рассмотрена только бета-версия amfphp2 и многие вещи могут измениться в будущем (надеемся, что будет реализована полная поддержка всех возможностей Flex Data Services 2). […]

  77.  
    CJ
    4/12/2007 | 9:22 pm
     

    I second the comment made by adrian:
    “I downloaded the source package from http://www.5etdemi.com/uploads/servicebrowser.zip .
    I tried to run the ServiceBrowser inside Flex Builder but seems that a class is missing , RawAmfService . Does anyone know where to find this one so we can be able to compile the project in Flex Builder ?”

    Thanks, can’t wait to start working on the flex service browser.

  78.  
    4/14/2007 | 9:59 am
     

    Patrick Mineault
    12/21/2006 | 11:36 am

    Yes, charset handling is probably broken for databases…I am looking into ways of solving the issue in an unobstrusive way. Stay tuned.

    // ————————————————

    I tried all the differents options in the gateway.php and in my flex frontend I see correctly the special chars, but directly in the database I see weird chars using phpMyAdmin and others local clients apps. This problem of the charset still there in the lastest version of amfphp?

    If I use the old AMF0 way this write fine the specials chars in the database, and using the same AMFPHP 1.9 and the same php classes. But when use the AMF3 way, this write garbage in the databse instead of the special chars. This happens with php4 and 5.

    Thanks in advance

  79.  
    Anonymous
    4/17/2007 | 1:55 pm
     

    dqdsq

  80.  
    5/8/2007 | 5:05 am
     

    Hi Patrick,

    because I didn’t now where else to put it I will put it here (the amfphp.org website seems to be replaced).

    after an upgrade to php 5.2.2 by our hosting provider the afmphp gateway.php (of version 1.2) file returned the default message saying that the installation is correct. However, it also did this when we called the gateway from our flash file.

    turns out that in this version, the input stream is no longer available by default…

    so, in amf-core/app/Gateway.php some things had to be changed to reach the
    $GLOBALS[”HTTPRAWPOST_DATA”]

    change the line:
    $GLOBALS[’amfphp’][’actions’] = $this->actions;

    to:
    $GLOBALS[’amfphp’][’actions’] = $this->actions;
    if (empty($GLOBALS[”HTTPRAWPOSTDATA”])) {
    $GLOBALS[”HTTP
    RAWPOSTDATA”] = filegetcontents(’php://input’);
    }

    this will solve the problem.
    If I’m correct, more of this might show up in the future, so I hope this helps out some people.

    Solution was kindly provided by our hosting provider (thanks to Piet Bijl)

  81.  
    5/8/2007 | 6:38 am
     

    Thanks De Kale, I will patch it ASAP.

  82.  
    jaccos
    5/18/2007 | 5:41 am
     

    I tried the examples from http://www.sephiroth.it/tutorials/flashPHP/flex_remoteobject/index.php and that worked fine.

    But now I want to use amfphp1.9 in actionscript. Can someone help me with an example

  83.  
    Tanuvan
    5/22/2007 | 10:32 am
     

    This has been a 1.9 beta for a while. When is it finally going to be 2.0?

  84.  
    6/1/2007 | 10:33 am
     

    Hello,
    I have some problems with getting the servicebrowser to work.
    I have the following config:
    1. drupal 5.1,
    2. amfphp seems to be properly installed:
    - I can reach services/amfphp
    - I can reach the standard drupal ‘node’ service.
    3. I have the amfphp/DiscoveryService.php as well as a simple HelloWorld.php in my services directory.

    However when setting up my Flex 2 project with the required values (as per the servicebrowser example), I keep getting the “AMFPHPRUNTIMEERROR” error with
    ‘Method does not exist.’ error message.

    Does anyone have a clue on what I’m doing wrong ?

    /Julien

  85.  
    Mass
    6/4/2007 | 5:43 am
     

    I’d like to know how to be able to get more content into the info tab when I use the browser.

    When I try a call on my browser the info tab only contains:

    Query took: 614 ms

    How can I get full details like in your example browser:

    Total time: 399 ms
    Encode time: 0 ms
    Send/receive time: 398 ms
    Decode time: 0 ms

    Thank you for your help!

  86.  
    Chris
    6/4/2007 | 9:21 am
     

    I just wanted to thank all of those who have contributed to amfphp, you guys rock! thanks for trying to extend flash in this way! keep on going!

    Cheers,

    Chris

  87.  
    Gla
    6/8/2007 | 6:41 am
     

    Patrick, can you expose your raodmap?
    we are waiting for the final amfphp 2.0.

  88.  
    r2
    6/10/2007 | 5:53 am
     

    First a very big Thank you to Patrick for such a cool tool. I just started with remoting and i find amfphp really easy to startup.

    I downloaded amfphp 1.9 from here http://www.5etdemi.com/uploads/amfphp-1.9.beta.zip and i also tried an updated version from here http://www.5etdemi.com/uploads/amfphp-1.9.beta.20070513.zip

    i installed amfphp in both cases and i am able to use the service browser (flex based) to view services (existing and those that i create)

    After defining PRODUCTION_SERVER to true in gateway.php i can still use the service browser to view methods from various services etc. How can this be disabled ? Is this a bug ? Did i miss something ?

    Finally, in case of an error im trying to prevent my service methods from sending back any error information to the client, i have tried all ini settings in PHP but if authentication fails to the database server an AMFPHPRUNTIMEERROR is sent back. (note that if the same method is called in a simple php script and loaded into the browser this error is not displayed because i have displayerrors=false)

    i have been looking for clues for the last 2 days, but haven’t come up with anything

    thank you

    r2

  89.  
    Lucas
    6/19/2007 | 1:36 pm
     

    Hi.
    Just run into the most akwark “bug” in my programming life,

    I’m using amfphp1.9 with flex 2.

    I am sending an array from flex to php and (in some conditions) when in php some values of the array change.

    1st. condition:

    values only change if there are repteated values on the array

    2nd condition

    if i send only the array from flex to php everything works fine

    3rd condition

    if i send an object with the array and another object
    if there are repeated values on the array i get problems things get even worst

    if i’m using flex default validators i get on php the second repeted value with a string from the other object

    if i don’t use validators it works just fine..

    check just before “leaving” flex and object is ok
    only get wrong on php…

    what’s going on?

    any help?

    thanks

  90.  
    xwisdom
    6/20/2007 | 6:35 pm
     

    Hi is amfphp still being developed?

  91.  
    lol
    7/4/2007 | 6:31 pm
     

    hello Patrick,
    have you a got a date for the 2.0 final ?
    i can’t hold back my excitement more longer :-/

    thank’s for all

  92.  
    Robert
    7/12/2007 | 11:44 pm
     

    I agree this software is fantastic. The problem I am having is with all the different flavors of AMFPHP out there and this 1.9 Beta being a major enhancement from previous versions a good tutorial is in desperate need. Its hard to tell what is designed for AMFPHP V.X. There are all kinds of examples going from PHP to Flex/Flash but we need to see some going from Flex/Flash to PHP. Usually there are quite a few files involved so a good clean example would be really nice! I would even pay for such a good clean Flex/PHP example utilizing the latest technologies from the latest AMFPHP 1.9 Beta like RemoteObjects etc. If you have something and would like to give it or let me know your price please contact me at $flex->dnsmagic(com). If it turns out nothing comes out of this and I ultimately figure it out myself I will write a tutorial myself and make it available.

    Again EXCELLENT JOB on AMFPHP in general and this EXCELLENT 1.9 Beta update!

  93.  
    7/17/2007 | 5:12 pm
     

    I think, SOAP RPC would be also a must have for amfphp, bur because of the WSDL return type creation, the methodTable has to stay. Have a look at my class, perhaps you are inspired. (I hope so)

  94.  
    7/20/2007 | 6:06 am
     

    very good

  95.  
    7/21/2007 | 4:35 pm
     

    Thanks for the advice,
    Michael

  96.  
    marty
    7/24/2007 | 10:21 am
     

    i have a strange problem, whenever i pass arguments with a number followed by underscore ( for example: “12_12″ amfphp returns “12″) the string is cut starting with the underscore. it seems to happen only for this case, characters followed by an underscore dont get cut. by the way, i am using PHP Version 5.2.2. does anyone have the same problem? if so, is there a solution for this?

    thank you

  97.  
    8/1/2007 | 3:33 am
     

    […] You can get more info about AMFPHP1.9 , here, and download the version we used for this example from here. […]

  98.  
    8/14/2007 | 3:17 pm
     

    Assuming that there was a liberal media bias, we didn’t believe the media, even though they were correct. The obvious solution, now that the media is vindicated and we were proven wrong, is to correct the liberal media bias which, as I just stated, only existed in our imaginations.

  99.  
    9/3/2007 | 8:03 pm
     

    hey wazzup,
    I was reading some stuff about amfphp and I saw you are going studying neuroscience. Have you read On Intelligence?
    I had a huge conversation yesterday. We were arguing whether the brain can adapt to new input of information and whether it would actually be able to make sense of the signal that comes from a lets say infrared camera. Opposition claimed that brain is already structured as you are born and since the centers for visual and audible are predefined, brain will not be good for analyzing other types of input.
    just curious what your stance is…
    Best,
    Pete

  100.  
    9/6/2007 | 1:29 pm
     

    what is amf 1.9 ?

  101.  
    9/9/2007 | 6:40 am
     

    everything preschool back to school ideas…

    everything preschool back to school ideas…

  102.  
    9/9/2007 | 6:40 am
     

    disney channel high school musical lyrics video…

    disney channel high school musical lyrics video…

  103.  
    9/14/2007 | 2:49 am
     

    Thans ! It is Very Good !

  104.  
    9/14/2007 | 8:50 am
     

    hello Patrick,
    have you a got a date for the 2.0 final ?
    i can’t hold back my excitement more longer :-/

    thank’s for all

  105.  
    9/14/2007 | 4:47 pm
     

    Is that possible for ASP ?

  106.  
    9/14/2007 | 6:04 pm
     

    its really perfect thanks for your works

  107.  
    9/14/2007 | 6:05 pm
     

    nice thnks

  108.  
    9/14/2007 | 6:07 pm
     

    I also wanna say thanks!

  109.  
    9/14/2007 | 6:08 pm
     

    greatfull work thnks

  110.  
    9/15/2007 | 4:13 am
     

    Great. added your blog in favorites

  111.  
    9/15/2007 | 4:14 am
     

    Great work. added your blog in favorites

  112.  
    9/15/2007 | 5:02 pm
     

    Is that alpha ?

  113.