I am trying to retrieve the code from an HTML file in PHP.
And display it in a textarea.
Example: if I have a file with a div and a foo h1 in it I want my textarea to appear like this.
After a few hours of research, I can’t find a good result.
And I want this html file to be readable in a textara that I styled.
Example right here of stylized file
Thank you in advance for your lights !
I tried to use fopen in order to be able to open the file and read it but I cannot convert my string into an html tag.
2
Answers
You should use readfile():
This will read the file and send it to the browser in one command. This is essentially the same as:
except that file_get_contents() may cause the script to crash for large files, while readfile() won’t.
Your can try using jQuery, below is the example code:
OR
Reference link: https://www.w3schools.com/howto/howto_html_include.asp