How android app can be generated through website? - php

I'm just curious about how these websites now a days can create an android apk? i mean what logic is behind it? is it possible that you can compile a code in PHP or is there something else?
e.g. for websites that can generate android apps
http://www.appsgeyser.com/
http://ibuildapp.com/
So just as a student, its killing me to know what they do for it?
Thanks

Nowerdays with the gradle build system that is not too hard. You just need to execute on the commandline gradlew aR and some minutes later you have a brand new apk file.
shell_exec('./gradlew aR');
That should do it's job but keep in mind that this can take some minutes.
A better way would be to queue that job in a database and execute the creation with a cronjob. That would be more secure.

They invoke the Android build tools on automatically generated code to produce the APK.
In fact, they do exactly what you would do to produce an APK, except that some of the code and resources are pre-built (and the same for every application), and whereas you would use Eclipse or Android Studio to compile the code, they are using scripts to so the same thing that the IDE would do.

Related

Can PHP attach to a running Windows process?

Are there any PHP functions/libraries that I can use to attach to a running process under the Windows OS ?
I'm playing an abandonware game and I would like to make changes to data in various memory locations whilst the game is running.
The game doesn't use Shared Memory, IPC's. I'm hoping PHP allows me to give the Process ID of the game, and then it can attach using some functions/library that I've not come across.
The GDB debgugger is one potential way forward, but I'd like to do everything in PHP if possible.
Any thoughts or ideas will be appreciated.
With PHP running on Windows you are able to create instances of ActiveX objects. But this will lead you to write an ActiveX class which gets all the information and does all the work. PHP would end for display only purposes and so you could create your html output directly with your ActiveX class / C++ / C# / whatever app.
Summary: For such a task PHP is not the best choice.

Working PHP.exe program and developing a timer program?

Hey Friends
how can i develop an app which work in php.exe in my php folder and i need to know can i develop an app which will work continuously using this function and able to work it on my CPanel?
EDIT
what i mean is,a principle one of my friend said to me to develop an page which is having a timer in it,in every 5 min it will check in a rss page for looking is there any change or new item is added or not?if we develop some thing like this it is difficult for us to work the php program again and again right??so i need some thing like that, and i need help in that
If you'er trying to develop a gui app, you might want to have a look at winbinder or php-gtk.
Ig you're asking how to write a program....then the answer is a bit long to include here.
You can develop a PHP app that runs on the command line (launched by php.exe). This way, you will not have a restriction on the running time. But it will not be integrated in CPanel.
I have to admit I probably didnt understand the question completly, so my answer is probably a bit off ...
Edit:
After your update, it seems that what you need is a cron/scheduler job. The cron job will call your script at intervals you specify. Google: PHP cron jobs.
If you mean periodically by "work continuously" you can use cron jobs (or windows scheduler). If you mean really continuosly, you should build an app with service/daemon functionality. As friends here already pointed out, it's a bit lenghty to fit in this edit box.

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

Using Pygments with PHP (Python in PHP)

Is it possible to use Python (specifically Pygments) with PHP? Currently, I have a phpBB forum that I'm developing for and JS Syntax Highlighters just haven't been working for me. There's already a GeSHI mod, but I want to develop something myself just for experience.
Also, would there be performance issues?
There is now a library for this at:
http://derek.simkowiak.net/pygments-for-php/
Pretty much the only way to perform that integration (with PHP as the dominant language) is to shell out. This means starting python manually every time you need it.
That can be a little slow if you need to do it a lot. You can mitigate this by creating the syntax hilite when posts are created or edited, not when viewing.
If you're interested in diving into Python, you could write an external script or server application to update new posts with syntax-highlighted code. If it were me, I'd retain the original code in one database column and place the syntax-highlighted version in another.
A simple script to update new posts in batches could run as a cron job at whatever interval you find ideal.
To support a near real-time scenario, you could write a server application that sits and waits to be notified of new posts one at a time. For example, upon processing a new post, the PHP application could send the highlighting application a message through an AMQP queue.

Making a distribultable standalone program in PHP

I've decided to code some applications in PHP that are supposed to run offline in the user's machine. However, I can't seem to find an user-friendly install wizard to create a local server in where the script will run. Any ideas?
PS: Here's an example of what I want: http://www.nolapro.com
You could go to the old school route and try using PHP-GTK.
Text Tutorial here: http://www.kksou.com/php-gtk2/References/Compiling-standalone-PHP-GTK2-applications-on-windows-using-PriadoBlender.php
or you could go the route that I believe has much more promise: Adobe AIR + PHP
It has the added bonus of running on any platform!
Video tutorials here: http://www.vtc.com/products/Adobe-AIR-PHP-Development-Tutorials.htm
There's also a new player in the game, Appcelerator. It lets you write your code in whatever language you want (PHP, Ruby, Python, etc) and compile it for the platform of choice (iPhone, Android, Windows, OSX). Parts of it are still beta, but it looks unbelievably slick & cool, and there are lots of tutorial videos. http://www.appcelerator.com
I hate to advocate this, because it just feels so wrong. You would probably be better off using a language inteded for use for stand-alone applications, if you're going to be doing this often or in a production setting.
With that said, a colleague of mine used to use the Bambalam PHP to EXE Compiler for this. He actually had a profitable product built around it.
Bambalam will generate an EXE that doesn't rely on any external DLLs, based on your PHP code.
http://www.bambalam.se/bamcompile/
If you have a webapp written, you maybe want to deploy on client, a possible way is use wapache, which is a standalone apache bundled with your application, and an integrated (IE) browser control inside.
http://wapache.sourceforge.net/
A new feature of PHP 5.4 & 6 can help you, the builtin web-server.
http://php.net/manual/en/features.commandline.webserver.php
With this feature you can host locally your php app without external webserver, and access on localhost.
If you really talking about a client application you are really wrong to do this.
If you want to wrap a server + browser to deploy your web based application so it runs local you might check out three options:
1) Deploy a simple webkit browser (you can get a QT Webkit Browser in 30 lines of code) and an apache server that is installed somewhere standalone (not via the apache control script as this uses port 80 and i probably conflicts with another installed webserver.
2) Look at the Firefox PRISMA solution. I have read about this only in a news article but it wrapps the firefox around one single start URL. You have to deploy a webserver in the same way as
3) Try to wrap it as a HTA application. Search the corresponding info on MSDN.
I would prefer (1) as you can add special application interacting code as needed.

Categories