Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   How to read the HTML file?? (http://www.go4expert.com/forums/read-html-file-t2176/)

eshban 9Dec2006 14:07

How to read the HTML file??

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">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>


<table width="80%" border="1">
    <td><img src="Image1.jpg" width="18" height="18" /></td>
    <td><img src="Image2.jpg" alt="sad" width="18" height="18" /></td>

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


pradeep 9Dec2006 14:59

Re: How to read the HTML file??
You can you regex to replace it! Match the src attribute and replace it with whatever you want.

eshban 11Dec2006 18:01

Re: How to read the HTML file??
Did you provide any source code which helps me

All times are GMT +5.5. The time now is 02:11.