You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by bilbosax <wa...@comcast.net> on 2016/08/24 00:31:54 UTC

Connect AIR to a Remote Server

I am trying to download information from a database located on my webserver
at inmotionhosting.com.  My url is www.billspencere.com.  How do I go about
doing this.  When I was developing an app in the past, I would connect to a
localhost on my personal machine.  But I assume in production, you have to
set up Zend and your PHP functions alongside your database on your
webserver.  So I am at a loss of how to connect to my online database using
AIR.  I tried setting up a PHP data service, but cannot validate the Web
Root and the Root URL.  I tried(and everything else in between):

Web Root: public_html
Root URL: http://www.billspencere.com/

This fails, saying "The selected web root folder does not exist.".  Can
somebody help me get started obtaining information from a remote server?

Thanks



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Connect-AIR-to-a-Remote-Server-tp13379.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Connect AIR to a Remote Server

Posted by OK <po...@olafkrueger.net>.
I assume you mean Zend_Amf_Server if you're speaking of Zend?
This might be helpul:
https://framework.zend.com/manual/1.12/en/zend.amf.server.html

I had used Zend_Amf_Server for a long time in the past and remember that
there could be some pitfalls.
E.g. you have to take care of the VO mapping, the class registration and of
course the services-config itself.
I've never used the FlashBuilder code generation/data-centric tools but to
avoid issues with it I recommed to implement the services by yourself.
As Jeffrey said it would be helpful if you provide some more details.

However, if it's an option for you to replace AMF by JSON (or XML) it makes
much sense to replace the Zend_Amf_Server by a REST server.
Building a REST server with PHP is easy using the awesome Slim framework:
http://www.slimframework.com/

Using this option you'll get a reusable API that could be consumed by any
http client.
If you combine SLIM with JSON Web Token (JWT) you be able to build real
stateless services (no state on the server side):
https://github.com/tuupola/slim-jwt-auth

I'd like to publish a tutorial using SLIM/JWT with Flex, but unfortunately
time is always not enough...we'll see...

HTH,
Olaf








--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Connect-AIR-to-a-Remote-Server-tp13379p13382.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Connect AIR to a Remote Server

Posted by OK <po...@olafkrueger.net>.
I don't want to totally confuse you but there's another option:
You could go with a on-premise backend as a service (baas) solution.

One baas candidate is dreamfactory:
http://www.dreamfactory.com/

It could be installed using bitnami in nearly 5 minutes.
https://bitnami.com/stack/dreamfactory

Dreamfactory provides ready to use APIs for MySQL and MongoDB and a lot of
other stuff,
including a file upload API.
Going with this kind of solution you don't need any database knowledge.
Just call the provided services and you're done!

HTH,
Olaf










--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Connect-AIR-to-a-Remote-Server-tp13379p13387.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Connect AIR to a Remote Server

Posted by OK <po...@olafkrueger.net>.
bilbosax wrote
> Writing pho/database interfaces is beyond my skill set and I would
> definitely need a tutorial to get it done. 

If you'd like to go with a REST server I could try to assist you.
If all works fine you be able to set up the complete environment in a few
minutes.
I'd recommed to install the complete setup at you local machine first.

1) Install the MEAN or LAMP stack using e.g. bitnami
https://bitnami.com/stack/lamp (MySQL)
OR
https://bitnami.com/stack/mean (MongoDB)

2) Install php composer
https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx

3) Install Slim using composer
http://www.slimframework.com/docs/start/installation.html

Now you could start coding your RESTful services that coud be easiliy
consumed by your flex app.
Let me know if you would give it a try...

If you'd like to stick with ZEND_AMF wich is also fine you should check if
your Zend_Server is working 
(Independent from Flex):
1) Check if your web server is up running and your PHP is working fine.
To verify it just create a simple phpinfo.php file and put it to your web
root:
File phpinfo.php:
<?php
echo phpinfo();
?>
Call this file in your web browser. You should see the phpinfo page.

2) Locate your Zend_Server gateway.php file (Most time the entry file is
called gateway.php or sometimes index.php)
Just call this gateway.php file in your browser and check if there occur any
errors.
If I remember it correctly it returns something like "Endpoint" if it works
correctly.

HTH,
Olaf






--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Connect-AIR-to-a-Remote-Server-tp13379p13386.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Connect AIR to a Remote Server

Posted by bilbosax <wa...@comcast.net>.
Well, if you ever do write it, let me know. Writing pho/database interfaces
is beyond my skill set and I would definitely need a tutorial to get it
done. Thanks for the info Olaf



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Connect-AIR-to-a-Remote-Server-tp13379p13385.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Connect AIR to a Remote Server

Posted by bilbosax <wa...@comcast.net>.
You are right in everything that you said, unfortunately, it is easier to
modify things once things are set up in Flash Builder.  The problem is, I
can't get Flash Builder to configure any of the PHP classes and objects
needed to connect to the remote database out of the box.  It appears you
have to set it up locally, and then transfer everything in the end(if I
understand it correctly).

So I found this link, and it worked for this guy.  He makes it sound like
you set up everything locally and then transfer the file structure over to
your remote server after you have everything built.  Then, you just have to
tell AIR to look for the gateway on your remote server by changing the
following:

_serviceControl.endpoint = "http://www.remote.com/gateway.php"

I will give this a try and report back what happens, but in the end, this is
probably the way to go.  Here is the link where I got this information:

http://stackoverflow.com/questions/2270430/using-a-remote-php-service-with-flex-flash-builder-air-application



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Connect-AIR-to-a-Remote-Server-tp13379p13381.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Connect AIR to a Remote Server

Posted by Jeffry Houser <je...@dot-com-it.com>.
  A lot of how you access your services on the remote server depends 
greatly on how the remote server is configured.  You are correct, you 
won't want to use localhost URLs as part of your production app.

   In most cases, you would just replace 'localhost' with your domain 
name, www.billspencere.com .  But, you'll need to configure the remote 
host similar to how your local was configured.  It sounds like this will 
require PHP to be set up on the remote machine, in addition to your 
database.

  I don't think you've given us enough information to provide you with 
more specifics.  Does this help?



On 8/23/2016 8:31 PM, bilbosax wrote:
> I am trying to download information from a database located on my webserver
> at inmotionhosting.com.  My url is www.billspencere.com.  How do I go about
> doing this.  When I was developing an app in the past, I would connect to a
> localhost on my personal machine.  But I assume in production, you have to
> set up Zend and your PHP functions alongside your database on your
> webserver.  So I am at a loss of how to connect to my online database using
> AIR.  I tried setting up a PHP data service, but cannot validate the Web
> Root and the Root URL.  I tried(and everything else in between):
>
> Web Root: public_html
> Root URL: http://www.billspencere.com/
>
> This fails, saying "The selected web root folder does not exist.".  Can
> somebody help me get started obtaining information from a remote server?
>
> Thanks
>
>
>
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Connect-AIR-to-a-Remote-Server-tp13379.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.

-- 
Jeffry Houser
Technical Entrepreneur
http://www.jeffryhouser.com
203-379-0773