Clear Filters
Clear Filters

how to read php file using matlab ?

7 views (last 30 days)
i tried using "urlread" ,which reads the html file .Why not php? . Even i specify php file it returned result which excludes the php code.

Accepted Answer

Guillaume
Guillaume on 7 Apr 2017
Your question does not make much sense. PHP is not HTML, it's meant to be interpreted by the web server and tells the server how to create the html it sends to the web client. urlread is a web client so it shouldn't even receive php code. If you give it an html file with embedded php, like all web clients, it does not know what to do with it.
In short, urlread can not, will not, and should not understand php.
  3 Comments
Guillaume
Guillaume on 8 Apr 2017
You don't. As said, a PHP script is never read from a web client. It is meaningless to such a client which should never see a PHP script. A PHP script is always executed by the web server.
If you really need to see the html generated by a php script, then you need to install php on your local machine. You could possibly get the script interpreted by the CLI interpreted that's bundled with most PHP install, if the script is very basic. Otherwise, you would also need to install a http server such as Apache, configure said server as the php script expects it, then use your web server to serve the web pages to urlread. This is not a trivial task and if you do it wrong you'll also open your machine to being easily hacked.
Again, php is just a language commonly used to generate web pages. Your question is equivalent to asking how to use urlread to execute some C++ / Fortran / Lisp / etc. code that generates html. It can't do it because it's not its job.
If you post your php script, I could possibly tell you what it does.
Bambos
Bambos on 4 Oct 2021
@Guillaume hello Sir,
i have a similar case, a web server displaying values using php.
Left you see the web server interface and right is the developer section of chrome browser.
Is there any way to get the electrical values from the right side ?

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!