How to read the HTML file??

eshban's Avatar, Join Date: Dec 2006
Newbie Member
Hello,

Iam facing a small problem in PHP.

I have some html code like

HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>

<table width="80%" border="1">
  <tr>
    <td><img src="Image1.jpg" width="18" height="18" /></td>
    <td><img src="Image2.jpg" alt="sad" width="18" height="18" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>
I want to make a small script which reads all the contents of this HTML CODE under the "BODY" tag and replaces all the "src=Image1" with my path which i had already stored in a Variable. Like after the script completion the path will be "images\Cat\ABC\image1.jpg"

How can i do this. Plz help, because i tried it, but i am failed. Hope for a good response and suggestions

THanks
0
pradeep's Avatar, Join Date: Apr 2005
Team Leader
You can you regex to replace it! Match the src attribute and replace it with whatever you want.
0
eshban's Avatar, Join Date: Dec 2006
Newbie Member
Did you provide any source code which helps me