Re: [flexcoders] Re: amfphp + codeigniter

2007-02-21 Thread Patrick Mineault
You have a few options here. The first is to call flickr directly 
through XML-RPC using Flex. You could use plain old E4X for that, or you 
could use a wrapper library for it. Try it here:

http://www.hrum.org/people/debedb/pro/blog/2006/12/xmlrpc_in_flex_2actionscript_3_1.html

As Renaun mentioned, you could also use REST services for Flickr, they 
work just as well. If I have a choice between REST and RPC, generally 
I'll choose RPC, but I don't know how good the library I just linked 
actually is.

The third option is to use a middle man, such as amfphp. In that case 
you could use the XML-RPC functions built into PHP, and just have amfphp 
resolve them. For example:

?php
class FlickrService
{
function doCall($function, $args)
{
//For example, $function = flickr.photos.getRecent
$apiKey = YourAPIKey;
array_unshift($args, $apiKey);
|
$request = xmlrpc_encode_request($function, $args);
$context = stream_context_create(array('http' = array(
   'method' = POST,
   'header' = Content-Type: text/xml,
   'content' = $request
)));
$file = file_get_contents(|http://api.flickr.com/services/xmlrpc/|, 
false, $context);
$response = xmlrpc_decode($file);
  return $response;
|}
}
?

Then just use ro.doCall(flickr.photos.getRecent, []);, where ro is 
your RemoteObject instance. That might be slower than a direct call but 
then again, you don't have to store the API ky on the client (a bad idea).

Patrick


joshuagatcke a écrit :

 I seen that flickr has rest web services, I am really just trying to 
 use xmlRPC from flex with
 PHP. This does not seem that possible. I thought I could close the gap 
 with AMFPHP, but that
 would be a realy pain. I might as well just trunk through the XML. I 
 am thoroughly
 disappointed with the flex + PHP combination. I wish I had know more 
 about the limitations
 of flex before I purchased flex builder.

  



[flexcoders] Re: amfphp + codeigniter

2007-02-21 Thread joshua gatcke

Thanks for the tips :)

As for the xmlrpc as 3 library link you posted, I had found this  
before and was unable to get this to work at all. Has anyone found a  
simple, reliable way to do xmlrpc calls directly from within flex?  
That would be the ultimate solution for our project.


- joshua





[flexcoders] Re: amfphp + codeigniter

2007-02-20 Thread joshuagatcke
I seen that flickr has rest web services, I am really just trying to use xmlRPC 
from flex with 
PHP. This does not seem that possible. I thought I could close the gap with 
AMFPHP, but that 
would be a realy pain. I might as well just trunk through the XML. I am 
thoroughly 
disappointed with the flex + PHP combination. I wish I had know more about the 
limitations 
of flex before I purchased flex builder. 



[flexcoders] Re: amfphp + codeigniter

2007-02-17 Thread Renaun Erickson
In regards to the Flickr question.  You can go Flex straight to
Flickr.  I did a quick mashup a while back, its up on the flex
cookbook site.

You can find it here:
http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetailspostId=1441productId=2

Renaun

--- In flexcoders@yahoogroups.com, joshua gatcke [EMAIL PROTECTED] wrote:

 Has anyone ever created a Flex + PHP project using AMFPHP +  
 Codeigniter? I have been trying to integrate the two with no luck.
 
 Or maybe I shouldn't integrate the two, the question then becomes:  
 does anyone know how to consume webservices from external sources  
 with amfphp? what I mean is, right now, with amfphp I have to point  
 my remoteobject tag to amfphp/gateway.php sending the method I want  
 to use etc. What if I wanted to use the remote object tag to access  
 flickr? would I have to call the flickr webservice from an amfphp  
 service and return the results to flex with amfphp, or is there a way  
 to go from flex - flickr using amfphp? If the latter is possible,  
 then I can just create xml-rpc web services in CI and serve them to  
 flex.
 
 I am trying to create a flex application that people can download and  
 install on their servers / host. That is why we are using PHP. I find  
 it incredibly limiting to use mx:httpservices with rest style data  
 exchange for my entire application, that is why I am trying to use  
 amfphp.
 
 Do a lot of you guys use flex + php? if so, what sort of development  
 approach do you take?
 
 THanks in advance for any help suggestions.