I am trying to create a script that will get multiple HTML files that could have PHP code in them and JavaScript code and make a big HTML/PHP file with that.
E.g home.php, news.php, something.php
Will be combined to form Index.php.
Before anyone ask why I need a file like that: the reason is to create 1 file that uses responsible layout for touch-swipe using parallax.
I’ve tried file_get_contents() but if the html has a simple <?php echo "hello world";?> it wont output it.
How could I merge multiple HTML files with anything in them (JS, php, etc)?
If you want the unexecuted PHP code, you will require an FTP connection to the PHP files. Using cURL, you’ll open an FTP connection and download the file, which will be in its original form with
<?php echo "hello world"; ?>and such. This is just like using a normal FTP client in your operating system to retrieve the file, in this case it will be in a variable in your PHP script, then you can execute the contents or do whatever from there.Of course this method is also dependent on whether the host (server) allows it.