Php into iframe card

Hi. I am trying to load a page in local php in an iframe. The server that answers me is python since I access from port 8123. Did someone implement a local php and call it from an iframe?

configuration of the iframe card
url: /local/acuarioweb/htmls/mediciones.html
aspect_ratio: 100%
type: iframe

This html calls a php file from javascript. But this one responds to the php code because it is not interpreting apache but it is interpreting it python

Thank you

o.O

??

Since Home Assistant isn’t running a php server, it cannot process php…

You would need to link it via your apache server if you’re running apache on the same machine as HomeAssistant something like this:

url: http://192.168.1.90/mediciones.html
aspect_ratio: 100%
type: iframe

Note replace 192.168.1.90 with the LAN IP of your HomeAssistant/Apache machine.

Does not allow http sites only allows https

The problem is that iframe does not allow http only allows https.
thought it was solved using python but I also did not
When I call the python file from a jquery ajax I receive the complete file code and not the json that should return
Thank you

Hi. In the iframe, load a local html that calls a python file with ajax. This should respond with a json as seen in the image but what answers me is all the code.

I do not realize what the problem is.

Your apache server isn’t setup to execute the code so it displays it.

I set it up and running it outside of home assistant works. But not inside.

I assumed that it did not work with php and that’s why I decided to use python, but I do not know if I have to configure something to build an “apache” for python

If you web server serves php just fine, it has nothing to do with Home Assistant.

If you are trying to use the home assistant built in web server, which is running python, it won’t work, because python.

This doesn’t even make sense. Apache is a web server, and Python can act as a web server. What EXACTLY are you trying to do?

in the iFrame I use the path /local/index.php and that does not work. Http sites inside mine which is https either. the only thing is to make my site https but I have not tried it yet.

I want from jQuery to call php to get back a JSON.

Again, the web server that is running home assistant is NOT capable of rendering php.

Why are you using jQuery to call php to get back json? You can do that with a plain ajax call to a web URL. You don’t need php

Sorry, i do not speak english. That makes my explanation difficult. What I try is to do a query to mysql and with that generate a JSON to see it in a table in html

Ok. But you don’t seem to get that php will not work on Home Assistant’s web server. You need a separate webserver for that. It doesn’t matter how you try to wrap it. If you’re trying to call a php script, unless it’s hosted on a different web service, IT WILL NOT WORK

okay. I installed a Nginx in my raspberry because it did not work. Decide that the home assistant’s www folder should interpret php?

You also need php7-fpm if you’re going to use nginx

yes. everything is installed. On the outside it works perfectly. the issue is when I change the root folder to sites-enables and I indicate the folder of the home assistant. There it continues to work but when I call it from home assistant it does not work

How are you calling it in home assistant?

You can’t just point to the file, you need to point to the URL hosting the service.

I’m sorry I do not understand. The home assistant folder is www. What I did is configure nginx so that the root is that folder.
Thanks for your helping

When I put an absolute url, throw this error

Maybe everything is solved if I get that website is safe too. I do not know how

Why would you make the home assistant directory the root for nginx??

What absolute URL are you using? Are you using index.php for your php file?

Share some info and we could help. Otherwise we’re just guessing at what you have.