Links swap
Posted: Mon Jul 12, 2010 8:00 am
Hello. I have a project that is a little bit complicated for me. I want to give the source of an html site as a string, check that string and save all the links in "href" to a database, then replace those links with the id that the database would give. For example:
What it would do is to save those two links in a database, into something like
And then swap the site with:
IM STUCK!!! Can anybody help me? Thanks!
Code: Select all
<html>
<body>
Hello, my name is <a href="http://www.link1.com">Xion</a>, and I'm trying to program in <a id="link" href="http://www.php.net">PHP</a>
</body>
</html>
What it would do is to save those two links in a database, into something like
Code: Select all
+------------------+------------------------------+
| Link_id | LINK |
+------------------+------------------------------+
| 1 | http://www.link1.com |
+------------------+------------------------------+
| 2 | http://www.php.net |
+------------------+------------------------------+
And then swap the site with:
Code: Select all
<html>
<body>
Hello, my name is <a href="1">Xion</a>, and I'm trying to program in <a id="link" href="2">PHP</a>
</body>
</html>
IM STUCK!!! Can anybody help me? Thanks!