Display PHP content using Adobe AIR

I used the following snippet to create a wrapper in FlashBuilder for an html/php application.

<mx:HTML id="myBrowser" location="http://127.0.0.1/index.html" 
       width="100%" height="100%" />

Open in new window


I have a local server running to serve the PHP pages. The problem I have is that the html pages display perfectly except the ones that have PHP code in them. Is there something I'm doing wrong? I'm using FlashBuilder 4.6
zerogAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
From what we see here, there is no PHP involved at all.  PHP is a server-side scripting language.  It is used to generate HTML documents that are then sent to the browser on the client side after the PHP script has finished running.  And PHP scripts are typically named with a suffix like ".php"

Perhaps you can set up the SSCCE that demonstrates the issue?  Then we can try to duplicate the problem on our servers, and maybe can get a little more insight.
0
zerogAuthor Commented:
In the PHP example I was linking to

<mx:HTML id="myBrowser" location="http://127.0.0.1/index.php" 
       width="100%" height="100%" />

Open in new window


But I just get a blank.
0
Ray PaseurCommented:
What do you get when you point your browser to http://127.0.0.1/index.php ?
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

zerogAuthor Commented:
Thank you for your prompt response. When I point my browser to the php page on local server it fine as it suppose to be.

Some background:

I'm using Server2Go as a local WAMP server. The settings in Server2Go allow you to execute an EXE when the server is started. I've set it to execute the testAIR.exe that I created in FlashBuilder. The code that makes up testAIR.exe is

<mx:HTML id="myBrowser" location="http://127.0.0.1/index.php" 
       width="100%" height="100%" />

Open in new window

With all the stuff in the same folder I tried changing the location to index.php, but it still didn't work.

Maybe I should upload a sample ZIP of everything.
0
Ray PaseurCommented:
OK, so we know that the PHP script is not part of the problem.  I think my next test would be to replace http://127.0.0.1/index.php with the URL of a known resource that contains a very simple HTML document.  If that works in the context and the PHP script fails, it would indicate to me that the PHP parser is not getting called in the context.
0
zerogAuthor Commented:
Will try that. If I change location to index.html, then testAIR.exe shows the html page. But maybe I should link to the html page using the local URL i.e. http://127.0.0.1/index.html 

Will update you.
0
Ray PaseurCommented:
Thinking out loud...

I don't have a complete understanding of what's going on there, so I'm just trying to eliminate some points of confusion.  One possible point of confusion would be the timing of the interactions in the client/server model.

In a normal "over-the-internet" environment, PHP is a server-side script that runs and is complete before the client browser receives any output at all.  The PHP script is started by an HTTP request, it generates the HTML document, the server sends the generated document and then the server disconnects and awaits the next request.

For this to work correctly in your environment, the <mx:HTML tag would need to present an HTTP request to the URL, and receive the document back from the URL.

We can add a further test to this process now, to see if the HTTP request is getting sent to PHP correctly.  To do that, temporarily replace the index.php script with something like this, substituting your own email address.

<?php
ob_start();
error_reporting(E_ALL);
echo 'Hello world';
error_log('Hello world');
$msg = ob_get_clean();
mail('You@Your.org', 'INDEX.PHP', $msg);

Open in new window

If you get the email message, we have proven that PHP is being called correctly.  If you do not get the email message, we have not proven the contra, but we have increased the suspicion.  If you have not received the email and there is nothing in the PHP error_log, it's looking a lot like the PHP parser is not getting called correctly.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
zerogAuthor Commented:
Thank you for the your detailed response in trying to help eliminate the problem I was experiencing. Using your code snippet, it seems that the testAIR.exe was calling the php file before the server2go WAMP stack was starting the server and php modules. Although the delay between the start up of the two was just a few seconds, it's what caused the problem.
0
Ray PaseurCommented:
Thanks for the points -- it's a great question!  And thanks for using EE, ~Ray
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Flex

From novice to tech pro — start learning today.