I have some analysed data in MATLAB which I need to send to a server. I have a php link to access the server. Any idea how to call php from MATLAB?
Thanks.
If you will frequently send data back and forth between MATLAB and your web server, perhaps you can consider using SaturnAPI. SaturnAPI provides a REST interface for your Matlab and Octave scripts, so that you don't have to install anything on your own server. It can even send Base64 encoded 3D plots to you. Here is the demo. Below is a diagram showing that you can pass inputs to the script via the SaturnParams variable in the HTTP call.
Disclosure: I work on SaturnAPI
Related
This is a very similar to the question posed at Use php and simPro API to list customers.
The response to that question suggests downloading examples from GitHub. I have downloaded the SimPro examples at GitHub and have them functioning on the commandline.
I want to be able to use a web page as an intermediary between my FileMaker Pro database and the SimPro API. I can pass data to a web page written in PHP. It can convert the data to JSON and form a call to SimPro receive a response and display the success or failure as a web page.
Presently I have my JSON data hardcoded so that I can test the process. When run from a web browser I don't get a result, though the code works perfectly well running from the command line.
I'm not sure what I need to do make the examples web compatible. Can someone push me in the right direction?
Would be more than happy to help - could you post a snippet of your code - minus the auth info of course - so that I can try to assist?
Do you have your code printing anything else to the browser first - so that you make sure the script is actually executing as it should from the web server side - and have you checked your web server logs for any errors?
In some cases I've seen this is usually due to PHP config (there are separate configs for CLI and CGI in most setups) and can mean whilst libraries are loaded in one environment they may not be available to the other. The web server also usually requires a reload if you have just loaded libraries for use within your script.
Hope that helps.
I have a c++ application that processes a sentence and responds back to the respective user. I have a website using php that I would like to post data to this application and receive this response. Ideally, the C++ would run on the webserver and not have to be fully loaded each time it is used, but i haven't been able to get a simple 'hello world' (with cgi or c++) to work on the webserver.
What would be the easiest way to integrate a c++ application into a website? Should this work with any webhost?
To Integrate them you can take two approaches.
1) Integrate C++ as a function into PHP with http://www.php-cpp.com
You can create a function, say my_complex_function, that when called in PHP, will execute a C++ code. You can read the site's documentation for information about it.
2) Keep them separate and communicate through HTTP/Pipes/Sockets/Other
You could build a C++ daemon that opens up some kind of communication interface like a Socket, then with PHP you open a socket to it, send the information through the socket, and receive the answer there too.
You can find socket examples for PHP here: http://php.net/manual/en/sockets.examples.php
I have a api built with PHP & Codeigniter + RestClient and its getting to the point speed matters. We have ALOT of code that the user should really not need to have to wait on to receive a response from the API that I would prefer to be executed AFTER the user receives a api response. Is this possible and if so how?
This is possible if your server run PHP as PHP-FPM. See in documentation functions with prefix fastcgi_
You can move your "special" code to separate file and run this file as daemon. Not sure about PHP scripts, but for Python scripts this is possible.
Im trying to get a Php page to be able to communicate with a C++ server. It must be able to recive and send at all time (and the same time). When the php page recives a string it shall make some changes in Mysql db but at the same time send other strings to the server.
You can think of it as a chat, but then the php recive a string it shall be formated.
The C++ server is up and running only the php client side is a mystery for me.
Is there any example code that anyone can help me with?
Thx!
Well first of all you need to understand and remember that PHP in itself is stateless. You can have PHP receive a request and parse it and do something with the gained information, but after that the request closes.
One solution you could try is having your C++ app HTTP POST to a PHP script. This script can parse and analyze the request and take action upon it.
Store something in the database
Create a response
Output the response
The C++ app can then do something with the response.
This will work but if your actual use case is a chatroom or something of the likes there are better solutions than using PHP.
does GWT support php ?
Useful links:
http://www.ibm.com/developerworks/xml/library/x-gwtphp/ (07 Apr 2009 )
and
http://www.gwtphp.com/
http://sourceforge.net/projects/gwtphp/)
http://code.google.com/p/gwtphp/
Havent used, so I can't tell if it's any good
To a certain extent, yes.
The heart of GWT is some magic for converting Java source code for a Web client into JavaScript. There's no wiggle room there; it's either Java or nothing.
But a GWT-translated client can interoperate with a server written in any language. You'd be missing out on some of the special remote calling capabilities offered by the GWT framework, but if you're willing to transfer XML or JSON back and forth, a PHP-based server could work with your Java/JavaScript-based client.
Yes, GWT completely supports PHP. Write your PHP script and use request builder to make the ajax call, then make your PHP return JSON data and use JSON parser within GWT to parse your JSON.
Normally, when you create a GWT application, it runs with the default java server, to direct it to your php server, use the following,
noserver -remoteUI "${gwt_remote_ui_server_port}:${unique_id}"
-startupUrl <name>.html
-logLevel INFO -codeServerPort 9997
-war /opt/lampp/htdocs/../war com.<appname>.<appname>
if ever you are using eclipse, simply place the app on your php server you are using