bosmedia Posted March 13, 2012 Share Posted March 13, 2012 I'm trying to build something similar to the "Try on your site" on http://www.mywebpresenters.com/ I want to let users enter in their URL, then I need to save the HTML of that URL/Page to a MySQL database using PHP. I then need to insert a div containing more code and then serve up the whole lot to the user again. I have done this using an IFrame but I'd like to do it better. Can anyone shed light on this? Also, This will be used on a WordPress site if that adds in anyway. Thanks in advance, Barry Link to comment https://forums.phpfreaks.com/topic/258799-saving-html-page-to-mysql-database-and-then-inserting-code-into-that-html-and-se/ Share on other sites More sharing options...
Muddy_Funster Posted March 13, 2012 Share Posted March 13, 2012 I gotta ask....why do you need a database for that? surely you can echo a file_get_contents within your div tags? Link to comment https://forums.phpfreaks.com/topic/258799-saving-html-page-to-mysql-database-and-then-inserting-code-into-that-html-and-se/#findComment-1326738 Share on other sites More sharing options...
bosmedia Posted March 13, 2012 Author Share Posted March 13, 2012 Thanks for your reply, Could I use: <?php $homepage = file_get_contents('http://www.example.com/'); echo $homepage; ?> to grab the HTML and then some way insert another div just after the opening body tag? I'm a bit new to this so any help is much appreciated! Barry Link to comment https://forums.phpfreaks.com/topic/258799-saving-html-page-to-mysql-database-and-then-inserting-code-into-that-html-and-se/#findComment-1326802 Share on other sites More sharing options...
Muddy_Funster Posted March 13, 2012 Share Posted March 13, 2012 in theory yes, once you have loaded the file_get_contents() into a variable it's effectivly just another sring as far as PHP is concerned (all be it a fairly large one in most cases), so all string functions will work on it. Link to comment https://forums.phpfreaks.com/topic/258799-saving-html-page-to-mysql-database-and-then-inserting-code-into-that-html-and-se/#findComment-1326810 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.