tags:

views:

205

answers:

5
+2  Q: 

Flex with PHP

I'm new to Flex and done a few application with only client side programming. Now I'm trying to do the back-end stuff using PHP. Can some one explain where(which folder) to put the PHP file for the Flex file to communicate with PHP. I'm using Flexbuilder 3 IDE.

Thanks

+2  A: 

Flex will not access your PHP script via the filesystem, you have to invoke your PHP script via a web server. The easiest solution is to use XML as in your data transport language. But you can get fancy and use something like BlazeDS

Cody Caughlan
+1  A: 

You may want to take a look at AMFPHP too, pretty handy.

euge1979
+2  A: 

This all really depends on what you want. I would make a very different recommendation if you wanted to simply poll the server occasionally than if you wanted to have a regular interface between the two.

If you are simply polling the server, I would recommend simply using the HTTPRequest class. It will allow you to create POST and GET data and serve to communicate relatively well.

On the other hand, if you are looking to have a more complicated set of communications between the server and the SWF, your best bet is the RemoteObject class with either AMFPHP, WebOrb, or an equivalent (we use WebOrb where I work). This has the benefit of allowing you to have objects of similar name/type in both Flex and PHP, meaning that communication can be made a good deal more comprehensive.

(If you are working this way, email me cwATallen-poole.com and I can give some pointers so that you do not have insane compiler arguments for Flex).

The next option is to use the XMLSocket class, but that seems to be a bit more intense than what you are looking for.

Christopher W. Allen-Poole
@Christopher W. Allen-Poole - Thanks for your reply. Could you provide me a valid mail id.
Omnipotent
cw AT allen-poole.com
Christopher W. Allen-Poole
+1  A: 

Try XAMPP.Very useful.

A: 

The new Flash Builder 4 (product formerly known as FlexBuilder) supports connecting to PHP services out of the box. The use the Zend Framework to do it, and will install the framework to your test webserver for you whenever you go to setup a data service.

Adobe video tutorials: Part 1 Part 2

Another good, non-video tutorial

Brian Stewart