I like php, and I'm beginning to like java. I heard that jsp is officially deprecated (on the oracle website) and I'm trying to figure out how I could get data from a php script (from field data, image uploads) send it to my java program and have the results sent back to my php script.
Now I know I could use php for everything but some websites (such as google) use multiple back ends such as C and python.
There are several possibilities to interface PHP and Java. To name a few you coud try:
Make a Webservice in Java and call this Webservice in PHP.
Use another RPC protocol, like Thrift.
There is also the PHP/Java bridge.
Quercus is a PHP implementation in Java. When using this, you can just write functions in Java and call them from PHP.
PHP has experimental support for integrating Java.
Related
I need to make my PHP app cooperate with CPLEX Solver. The good news is I'm familiar with LP, but the bad news is I haven't used CPLEX until now. From the documentation I can see that using CPLEX is fairly easy through the integrated IDE, or via default C, JAVA, C#, Python APIs or a callable library API. Unfortunately, I can't seem to find any examples at all of CPLEX being used from PHP.
Is such a thing even possible? I know I can execute any bash command through exec, but CPLEX often requires several interactive steps to be performed to solve a single problem, and I don'g know how to do that from PHP;
If answer to 1. is 'yes', can anyone share even a simple example of how it can be done? I.e. a PHP script that calls CPLEX to resolve an LP problem.
There won't likely be any ready made examples because there is only a callable lib for C and an API for C++, Java and C#. There is also a separate Python API.
You could potentially use Gearman or write a REST wrapper in Python that your PHP app could consume.
Alternatively you could write your own PHP extension that wraps the C functions you need to call. Not sure if you can precisely what you need to do with Zephir but you could have a look - it's really simple to get started with...
I am familiar with phonegap framework which convert html & jquery code to native app. But it does not support php. So i am looking for alternative.
with Zend Studio 10 you can make your app using PHP
Cloud Connected Mobile app is new entry for PHP Developers to make native apps(android, blackberry, windows phone) with just SINGLE click.
Zend CCM link
PHP is a server side language while jQuery and html being client side. What I mean is this that the PHP script is being interpreted on the server using the PHP plugin and compiler and so if it has to run on phone it need to be compiled in the phone with the required plugins.
Seems impossible to now because of that the PHP compiler is not available for android and for making such you should be able to port it to android.
Which I think takes a lot of time and digging the PHP compiler sources.
In my personal view, do not use a language designed specifically for web server-side purposes on a web client. Everything you can do with PHP locally on a phone you can also do with Javascript, and usually much easier because of its tight integration with the browser.
That said, there is a PHP for Android project which might provide what you want.
are there any C++ version for PHP Snoopy?
Snoopy is a PHP class that provides the functionality of a web-browser.
http://sourceforge.net/projects/snoopy/
The closest pure C++ solution I know is people that have written there own browser automation or scraping using Qt and Webkit, though there doesn't seem to be a library you could interface directly with. Most of the code snippets that are posted using the Python binding to Qt and Webkit.
You could try using phantomjs directly as opposed to through its Javascript API.
I am working on a PHP project that makes use of MLB's Gameday data. There appears to be a pretty solid Ruby library for working with data. I don't particularly want to rewrite the entire library in PHP, so I was wondering if anyone had any suggestions for a good way to interact with the Ruby scripts from my PHP application.
I'm starting to think that I'll need to write some sort of command line Ruby script that'll interact with the Ruby classes and output the data in a format usable by PHP (JSON, XML).
Are there any better ways to do accomplish this?
Another option is to use Gearman, written by the the same team that brought us memcached. It has PHP and Ruby bindings.
You'd create a daemon in Ruby that exposes functions to Gearman, then have your PHP code call those functions through Gearman. No Apache needed.
(Boy, I'm on a Gearman plugging streak. I wish I was getting paid for it!)
Rather then a command line interface, I'd suggest outputting data in JSON format and requesting that data via PHP & CURL.
If you needed to you could even write a REST interface for it pretty easily.
I am planning to build a web application and am going to host it. Since hosting cost less for php and it being similar to .net i am planning to go for php.
I am basically a .net guy. But have no issues in learning php if it is similar to .net. Please give in your opinoins in doing so. Also please tell me if php supports asynchronous calls like the AJAX in asp.net. Give me your comments.
AJAX stands for Asynchronous Javascript And XML. PHP isn't mentioned anywhere, and doesn't need to be asynchronous to facilitate this.
The process is that a Javascript function calls a synchronous PHP page that returns results and the users browser is updated. The asycnhronous bit is that the javascript function doesn't block when it makes the call, and a callback function is fired when the PHP page returns.
I've implemented AJAX in PHP with no special programming above normal PHP HTML rendering and Javascript calls.
PHP has no built in support for asynchronous calls. You can make pseudo-asynchronous calls using curl.
If you plane to request MySQL, the MySQL driver bundled into PHP5.3 can make parallels queries. see the doc http://php.net/manual/mysqli.poll.php
You can also delegate tasks / emulate parallelism with gearman