Compile AS3 into a SWF online using Flex SDK's mxmlc - php

Read my question thoroughly before responding, I know there’s a site called wonderfl.net
I‘ve got the Flex SDK 4 on my Mac and I found a way to compile AS3 into SWF files using Flex's mxmlc compiler in Xcode, so I wondered, would it be possible to do this sort of simply online? Using for example a language I'm familiar with, PHP?
I thought it’d be a thing that would be interesting to use for a website, or like some private projects.
Thanks in advance!

You have the available tools to do so. You can write the AS3 content posted from the web into files, use PHP's exec function to run mxmlc, then send the resulting .SWF file to the client using PHP's readfile function. You'd just have to make sure mxmlc was present on the web server running the PHP.

Related

How to run php code inside cordova?

I am new to cordova and want to transfer my existing app build with jquery mobile and php to iOS/Android. Am I correct, that there is no php interpreter inside cordova? That would mean, that the existing app is not transfarable to cordova as php is a central component in building those html files inside the project. This would make it kind of useless for me.
Is there a way to run php code inside cordova?
You cannot use any server-side scripting language (ex: PHP) inside cordova. But using Jquery and AJAX you can call php functions and get data easily.
PHP runs on the server-side; Cordova packages your app into a client-side application.
If you really really want to use your PHP server-generated HTML, rather than static HTML in your client-side app, you can package in an almost empty HTML file, and dynamically fetch HTML from your PHP server, AJAX or otherwise.
In today's age, with AJAX and HTML5 apps, most people will tell you that the server's role should not be to generate HTML files; it should be to generate data (JSON) through APIs. If you switch to such an architecture, you'll find that there are much more tools you can use easily.
Actually, you could use Quercus in Java to feed HTTP parameters to a PHP interpreter, no IP port necessary (you can construct a HTTP-request-holding data object) and for IOS, something like https://github.com/grantjbutler/PHPTest.
There are other embeddable solutions for IOS, I may edit this answer further, in the near future.
Quick search yielded this result: quercus: php in java (open source, 100% java implementation of php) so it should be possible to write plugin that execute your php code, probably with little modification. And then expose it in window.Plugin.method() like other plugins do (like this one cordova-plugin-shell-exec).

In PHP how to deliver website to client without giving them source code

As in JSP we give "WAR" file to clients and it contains .class files and other configuration files but not the source code, is there any way, in PHP, to deliver the project (website) to client without giving them source code.
Facebook created a project called HipHop php, a php compiler.
See this post:
Can you "compile" PHP code?
Short answer, not really.
I mean you can compile php into a single .phar file however anyone with moderate php knowledge can get the code from that.
There are also solutions http://www.ioncube.com/ though I don't know how easily someone can get the code from it however I would strongly advise against any solution like this as they generally require the user of this "compiled" code to you their proprietary software to run it.

Using php as a desktop application [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
PHP as a Desktop Programming Language
I have developed a sales application with php (codeigniter framework). i am using xampp to run this application in local PC's browser. now i want 2 things:
is there any way to run this application as a desktop application? something like an icon will open the app and run without any browser. also without xampp to be set up.
also i want to protect the code from unauthorized using. someone can easily copy the code and run it on other computer. i want to prevent this.
please help me about these issues. thanks in advance.
PHP is not really suitable for either of these things. You're going to need a browser either way, but you could if you really wanted to use some kind of custom browser (e.g., you can use Java or .NET to create a window that has a basic browser page with only whatever controls you want to add on it rather than a full browser).
You won't be able to prevent people copying it, but you could try googling for a PHP obfuscator to make the code hard to read and you could add whatever checks you may wish to determine the PC is one you've approved (perhaps some kind of license file and you could activate it against a MAC address or something).
You can use PHP/GTK+ to create a PHP Desktop Application, but the code protection is very difficult, you can try ofuscating the code, or you can use a php compiler like this: http://www.phpcompiler.org/
I would not use php to develop a desktop application as you like, try using another language, dont use scripting, use compiled codes.
Luck with you project.
PHP is a recursive acronym which stands for "PHP: Hypertext Preprocessor." At its core, PHP is designed to process information and output it as HTML ("Hypertext"). If you wish to output information primarily as something other than HTML, PHP is probably the wrong language.
PHP is also a scripting language. That means that it is not compiled (converted from source code to machine code). As such, the scripts are human-readable. Tools such as phc exist, but if you want a compiled application, PHP is probably the wrong language.
Can you use PHP as a desktop application? Yes. Can you compile PHP? Yes. Should you? Probably not, because you are circumventing the purpose and features of the language.
If you are interested in writing client-side applications with PHP, you have to use PHP-GTK. I don't know how flexible is that. In any case, you should try it to see what it can do for you ;)

Convert PHP-MySQL web application to desktop app (exe)

I have developed a PHP-MySQL web application, which is a school-based project.
My client wants this application to be converted into a .exe file such that it can be installed on his desktop and use it.
How the PHP website can be converted to a .exe file and can it be run without the need of a database/server software?
Please advice.
The convenient solution is not to convert the website to .exe. I think it will be better if you have portable server/php/mysql and make the website work from a usb or CD with autorun.
NuSphere's PhpDock claims to do this: It serves as a deployment helper and comes with a bundled web server. However, I don't know about the database part, and it's not free.
PhpDock enables you to deploy any PHP web application as a Stand Alone Windows Desktop application w/o any changes in the code.
I don't know that particular product, but I have been using their IDE for years and am quite happy.
try using a site-specific browser. it will make a desktop app that is basically a portal running to your webapp. try this one:
https://mozillalabs.com/prism/
It allows alot of advanced features like system tray icons and such. I have used it many times!
Hope this helps, JL
Short answer: Not possible.
Long answer: It depends.
You could install a web- and database server on his machine (or create an installer that does it) and run the application locally on his machine.
or
You keep the application on a server and just provide a launcher that opens his browser and points it to the URL of the application.
As Artefacto mentioned, it might be a good idea to switch to SQLite instead of MySQL but depending on how your application is written it might require a lot of code and SQL Query changes.
No. You have at least to remove the dependency on MySQL (and use e.g. sqlite instead).
Then, you would either have to:
Convert the webpages to windows dialogs. This would completely change your application (e.g. what would originally be http "form submissions" would be someting completely different). At this point, it'd much easier to write a .NET application
Bundle a web server (e.g. Apache) with PHP installed.
Another try would be to turn your php project into PHP-GTK (http://gtk.php.net/).
Yet another one is to give HPHP a try (https://github.com/facebook/hiphop-php/wiki/) and try to turn the generated C code into something like a .DLL in .NET and use it for the logic while coding the UI in say, C#.
Just create a simple program in C or C++ that will just add icon in Start menu, desktop and Quickstart. If your client clicks the icon it will open the default OS browser and point it to URI of your application online.
That might fool your client :)
Or maybe it will be enough for him (he might be asking you to convert it to exe because he can't remember URI or something - ask him what is the reason).
You can use xampp open-source project to pack your PHP site into an executable file.
Use the following steps:-
1. Download Xampp source code.
Add your PHP file inside htdocs directory(Ref:- https://sourceforge.net/p/xampp/code/HEAD/tree/win32/xampp/htdocs/).
Now compile the XAMPP source code and distribute it.
For DATABASE creation and initial data loading in the database, you can code your site in such way that if database is not created, it redirects the page to install.php which do the database creation and data loading task using sql file provided(you need to add SQL file containing database structure and required data).
Don't forget to delete the SQL file post installation of database.
Not sure that's gonna be possible but have a look at:
WinBinder
WinBinder is a new open source
extension for PHP, the script
programming language. It allows PHP
programmers to easily build native
Windows applications.
(source: winbinder.org)
Solution 1:
There are several solutions to convert your web application into a desktop application, the one I prefer is the open source solution: PhpDesktop, but unfortunately it only supports SQLite.
Best Solution:
To convert your PHP application with MySQL I know a paid solution that does this: 'ExeOutPut For Desktop', it is the best for this job
Php desktop is the way to go, it's actually very simple to modify to the version of PHP you want to use and is open source too https://github.com/cztomczak/phpdesktop

Stream data (such as music) using PHP (or another language)

For years, I've been investigating how to create music streams from my computer. I've seen programs, but anything useful I've seen is Windows only (I use a Mac).
Eventually, I got interested in how streams work. Is there any way I could create my own stream, possibly using socket functions in PHP? Is there a PHP library for this?
Take a look at Ampache. It is a Web-based Open Source Audio file manager. It is implemented with MySQL, and PHP. It allows you to view, edit, and play your audio files via the web.
In the end it all boils down to the protocol you'd want to use. Shoutcast IMHO is plain HTTP, so to make your own stream, you just output the streams content.
To make an ogg based webradio work with my Sonos system, I have created a little transcoding wrapper around sox which is is actually written in PHP, so it may be helpful to you to serve as an example.
You'll find it here: http://www.gnegg.ch/ogg2mp3/
If you are after implementing your very own streaming protocol - maybe even UDP based, then, I'm afraid, PHP may not be the right solution for the problem - at least not as long as it has its share of problems when used for long running processes (which 5.3 may bring some help for with its integrated garbage collection)

Categories