Search code examples
phpserverraspberry-pihtmlepiphany

Open browser on server after receiving url from client


Using a Raspberry Pi, I have created a web-server.

End goal: The web-page prompts the user for the URL, the URL is sent from the client to the server, and the URL is opened in the Raspberry Pi's browser: Epiphany.

As of now, I have a basic form for the URL on the web-page, and once the submit button is pressed, the server uses PHP to read the input.

How can I open a webpage on the server, Raspberry Pi, with that URL?

Update: Forgot to mention, the Raspberry Pi is running Raspbian.


Solution

  • This sounds like an X11 display problem.

    Using shell_exec, have your web server show the value of the DISPLAY environment variable. If it's not set, you'll need to set it (probably to :1.0).

    You may also need to use xhost + to grant permission to the root user (assuming the web server is running as root).