Jump to content

Saving HTML page to MySQL Database and then inserting code into that HTML and se


Recommended Posts

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

 

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

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.