remote implementing c++ program through php - php

Recently I've been working on web page based remote control. the function is already there done by c++ and now I'm trying to find a way linking this function to my web page.
I tried using soap and now almost give up because of those "cannot load wsdl file" and "http get method not implemented" errors
Is there any other way to do this beside using soap?
Cheers

Do you really want to use PHP?
You can also put the webpage stuff in the C++ application and make it a (fast)cgi application or by using a framework like wt or CppCMS

This sounds rather general so here are some possible directions:
Bind C++ to a custom php module
Call C++ binary with php system('')
Maintain a control socket (TCP / UDP /...) in C++ Daemon and connect from PHP
Integrate C++ in other Application Framework than PHP (.Net, ...)
As for the soap errors, what did you use to wrap your C++ into a SOAP Provider?

Related

How to expose a C library to a RESTful web service

I have a shared library written in C Language on Linux environment.
How to expose those shared library API's to REST based PHP WebService?
If you don't want to do it the "exec" way, you will have to do some work before you can get it working directly from within php.
Check this http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/ tutorial.
You will have to write a config.m4 file and put PHP specific includes and variables in your C code.
Check this answer:
Linking a PHP Extension Written in C
It's a good example.
It's a little ugly, but you can do methods in your PHP REST Api to call the process via system, exec, passthru... parse the info returned by the library and return the result in json format by the PHP Api.

ColdFusion and PHP in same Flex application

I am working on a web application in Flex.
I have already used PHP as a "Flex Server", but now I need to add a mailing service and it seems that ColdFusion is the perfect tool for it.
I don't want to waste time and rewrite all the PHP services to ColdFusion, so I am wondering if it is possible to have PHP and ColdFusion in the same web app.
In the project properties for Flex Server I can only choose PHP or ColdFusion but not both.
Can I somehow manually connect to ColdFusion?
In the project properties for Flex Server I can only choose PHP or
ColdFusion but not both. Can I somehow manually connect to ColdFusion?
The Flex Server option is really meaningless in Flash Builder. I think it helps Flash Builder find the services-config file. I always leave it blank or select none and manually specify the services config file as a compiler argument.
I assume you are using AMF / Flash Remoting; is that correct? You can find the services-config file that is currently being compiled into your app and modify it to add a new destination for ColdFusion services. You may want to combine your current services-config file with the one that comes with ColdFusion.
You should look for the CF Serivces-config file in a directory similar to this:
C:\JavaServer\servers\CFInstanceName\cfusion.ear\cfusion.war\WEB-INF\flex
It'll be slightly different if you're using the standard edition of ColdFusion instead of the multi server edition. I'm not sure where to find the PHP config file; but the two files should be very similar.
Of course, I assume that PHP can also send email relatively easily and I'm not sure the short-term gains of building this will outweigh the long term headaches of dealing with two technologies side by side.

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

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.

PHP Web Service with SOAP

I realize it's possible to create a PHP Web Service using SOAP, however, are there classes within PHP that make this easier than hand creating the SOAP messages?
I want to use php has a webservice using wsdl
with this link
https://qa-api.ukmail.com/Services/UKMAuthenticationServices/UKMAuthenticationService.svc?wsdl
to integrate uk mail api in to my php web application
but dont now how to do it ?? any help
There are:
The PHP SOAP functions
The PEAR::SOAP module
nusoap
They should all interoperate fine with .NET - it's just XML after all...
You want to try nuSOAP which you can get from here http://sourceforge.net/projects/nusoap/
Very easy as I had to create a PHP SOAP service and I didnt know PHP as I'm a C# .net person!
And just to add to that, as long as you implement the wsdl and SOAP methods correctly you should be fine. I had it working with .net with no trouble at all
Sure...
http://us2.php.net/manual/en/class.soapserver.php
There used to be an example in there somewhere... I couldn't find it though...

interfacing erlang application with php

I have a website built with PHP.
I have an Erlang application running as a daemon on the same server.
I need to call functions on the Erlang application from PHP and get back the result.
I've found PHP/Erlang and over PHP modules but I can't install a PHP module on this server, I can only use PHP code.
The only way I know to solve it is run an Erlang web server locally that the PHP will be able to talk to.
Is there a better way to solve it?
If using a httpd server is the best way, what Erlang server should I use?
It should be as light as possible and doesn't need features like SSL and doesn't need to handle large load.
Thanks
I'd run a webserver such as mochiweb hosting the erlang code. The PHP code would use curl to send http queries encoded in JSON to mochiweb. Mochiweb has a JSON encoder/decoder and PHP has native JSON support.
Even if every thing is on the same server, just use HTTP. Handles all the low level stuff and if you need to scale, it will be easier, as scaling with HTTP is a solved problem. Mochiweb is light and has high performance.
Erlang is excellent at socket I/O: maybe you could use a pipe of some sort?
This would be more direct than through another WEB server layer for sure.
Use the functions erlang:open_port and erlang:port_command functions to get data in/out of Erlang through a system port.
$ cat erl.erl
#!/usr/bin/env escript
main(Args) ->
io:format("~p\n", [Args]),
io:format("~p\n", [(catch test(Args))]).
test([N1,N2|_]) ->
lists:seq(list_to_integer(N1),list_to_integer(N2)).
$ chmod +x erl.erl
$ cat php.php
?php
var_dump(exec("./erl.erl 1 5"));
?>
$ php php.php
string(11) "[1,2,3,4,5]"
Have a look at erl_call. http://www.erlang.org/doc/man/erl_call.html
It is a unix program which is used to call a function in erlang. It will start a dummy erl node, execute the command(s) and return the result. You could use PHP to call erl_call and then use the results it returns.
I don't think there is better solution.
I need Erlang webserver to run it on web.
here is some info PHP+Erlang related
http://yaws.hyber.org/cgi.yaws

Categories