Posts filed under 'Flex,AMF,PHP'
Stratus is an Adobe technology up on labs that allows for Flash Player 10 and AIR 1.5 RTMFP real time communication connections. The most important features of RTMFP include low latency, end-to-end peering capability, security and scalability.
As part of the labs release there are an article and sample application.
Article 1
Stratus Sample Application
The Stratus Sample Application source files come with a cgi script for registering user’s identities (the NetConnection.nearId used for RTMFP net stream connections).
What this post is all about is a port of that cgi script to PHP. I was playing with the Stratus application on my own server and used PHP so I figured I would put the file out for others to use.
The file is renamed to a text file reg.txt but just download it and rename to reg.php to use.
April 7th, 2009
The default AMFPHP patterns for including classes defined in your AMF requests do not work for POG classes. The two default patterns that are check for class including by the AMF deserializer are:
PHP:
-
// $mappedClass = SomeObject
-
$mappedClass . "php" // SomeObject.php
-
// or
-
$mappedClass . ".class.php" //SomeObject.class.php
For POG classes the pattern is "class.someobject.php", regardless of the case of the SomeObject class.
Now to added different locations for AMFPHP to look for classes to include for deserialization of AMF requests you open up /amfphp/core/amf/io/AMFBaseDeserializer.php. Go to line 384 (as of AMFPHP 1.9 or the block of code starting with file_exists($GLOBALS['amfphp']['customMappingsPath']) and add the following code for POG classes pattern:
PHP:
-
elseif(file_exists($GLOBALS['amfphp']['customMappingsPath'] .
'class.' .
strtolower($mappedClass) .
'.php'))
-
{
-
$include =
$GLOBALS['amfphp']['customMappingsPath'] .
'class.' .
strtolower($mappedClass) .
'.php';
-
}
Now your AMF request classes passed in method parameters will be deserialized on the PHP to the correct POG class.
March 21st, 2008
Ok that was a long title. But I just got done with presenting at ZendCon 2007 in San Francisco and feel like a long title. The session was geared to take Cal Evan's, "Flex and PHP: Party in the Front, Business in the Back", a do some Flex enhancements on the Front end side.
What came out of the session was a Flex RSS Picture Book. Using Ely Greenfield's FlexBook component, the picture book displays images from the keyword's of the articles description text.
Here is the live example of the Flex RSS Picture Book, remember to click on the image to see the Article's title and description.
You can find the Flex RSS Picture Book source here, this source includes just the MXML and a slightly modified FlexBook source to handle crossdomain security. You'll need to get the PHP source from Cal Evan's original article.
Other Links: Funny Pictures Funny Pictures
October 9th, 2007
You'll find the PDF's of the session on Flex and PHP on the MAX website. I think its available to people who attended MAX and later it will be available to everyone. The didn't seem to put up the actual source code that went along with the session. The session was gear for someone with no Flex experience, but the people attending MAX and the session had plenty of Flex experience.
Between trying to change up the session for the higher skill level, the machines having issues, and the internet not working on the time what I presented at MAX differs slightly from the material here. You can find a excerpt from the PDF handout here to get your going on the PHP side of the session. You'll find on the last page of the PDF instructions of how to setup Apache PHP and mySQL on a Windows XP box as well as how to setup the Flex Builder 3, PHPEclipse plugin and the Zend Framework.
Either way you can find plenty of information on Flex and PHP examples on my blog. Here are two links to some source files:
MAX 2007 Flex and PHP source material
360Flex Flex and PHP examples
October 6th, 2007
This year at MAX I will be presenting one of the hands on sessions. It is titled:
RA101H: Hands On: Building a Rich Internet Application with Flex 3 and PHP.
It is geared for people with no Flex experience and will be pretty basic overview of Flex 3 and connecting to PHP through HTTPService. The fun part is I will be giving the session 4 times over the course of the 3 days. If you are going to MAX feel free to come by join a session or say hi.
September 26th, 2007
I will speaking at the 2007 Zend/PHP Conference and Expo, http://zendcon.com. The title of the session is, "Build a Sexy Front End to a Zend Framework Powered Application". I will be using a previous Flex/PHP example created by Cal Evans.
If you are going to ZendCon this year come by and say hi on Tuesday. My session is at 11:15am.
September 10th, 2007
Its cool to see the Flex developer base grow more and more everyday. I came across a Flex and PHP article in the lastest php|architect magazine. The article is titled "Flexing PHP" and is by Jeof Oyster. If you read Jeof Oyster's bio, he is a product manager for a financial services company and freelancer by night. This is a cool sign of the breadth of Flex developers and the rise in outside Adobe/Macromedia circles expose Flex is getting.
The article is a good overview of the Flex builder and SDK and now to create a Flex application along with accessing data through HTTPService and PHP. Check it out at http://www.phparch.com (June 2007 issue).
June 21st, 2007
The RemoteObjectAMF0 under went a few updates.
- Updated code with better comments for ASDoc's and readability
- Added SetCredentials
- Added Fault handler for NetStatus errors
- Added 1st round implementation for "method" definitions.
- Allowing you to define result/fault event handlers per method.
- This is done with a <renaun:methods/> tag and a <renaun:method/> component.
Example of using the <renaun:methods/> tag:
XML:
-
<renaun:RemoteObjectAMF0
-
id="contactsService"
-
source="ContactsService"
-
endpoint="http://localhost/amfphp1_9/gateway.php"
-
fault="Alert.show( event.message.toString() )">
-
<renaun:methods>
-
<renaun:method
-
name="GetContacts"
-
result="changeContactList( event )"
-
makeObjectsBindable="true" />
-
-
<renaun:method
-
name="MaintainContact"
-
result="Alert.show( event.result.toString() )"
-
makeObjectsBindable="true" />
-
-
</renaun:methods>
-
</renaun:RemoteObjectAMF0>
You can find the full source to this example in the 360Flex presentation source located at:
http://renaun.com/360Flex/
The updated RemoteObjectAMF0 code can be found at - http://renaun.com/flex2/RemoteObjectAMF0/renaun_com_RemoteObjectAMF0.zip
NOTE: The zip download now includes a swc compiled for Flex 3 which was giving a warning about a override method error.
March 12th, 2007
Currently the 360Flex conference is on it's second day. More than half over. I had the fun opportunity to be called out of a session to find out that my presentation has been changed from today til tomorrow (Ben Forta flys out tomorrow and needed to switch). The switch doesn't bother just glad to help. So for those that are wondering it is changed to tomorrow at 2:30pm.
I have prepared and some example code based on Tom Ortega's 360Flex Contact Manager. It takes the Flex application Tom created in Flex 101 and puts a PHP backend on it. The examples I will be walking through is not just one way but 4 different methods of talking to Flex with PHP. I will show how to communicate with Flex through XML (Simple), FlashVars, SOAP (Nusoap), and AMF (AMF0 and AMF3).
In the process I have updated the RemoteObjectAMF0 component I created many a month ago.
Some time when I get back from the conference I'll talk about the specific updates I made to RemoteObjectAMF0. Those attending the conference will get the sneak peek.
March 6th, 2007
I have updated the Cairngorm Store multiple backend example. Along with the updated source code I have deploy a live running example. The 4 backends it supports now is ColdFusion Remoting AMF3, AMFPHP AMF0 using the RemoteObjectAMF0 class, AMFPHP 1.9 AMF3, and ColdFusion WebServices.
See it live here!
Get the source here!
To change the backend of the Cairngorm Store example just select the backend you want from ComboBox and then click on the Refresh Data button. I had to do write some exception code to convert the returned XML data into the ArrayCollection to conform all the backend but besides that it was really easy to integrate all of them into the Services.mxml.
PS: I just installed a new license on the ColdFusion server with a new Apache web server configuration so let me know if there are any issues.
December 19th, 2006
Previous Posts