1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

How to read the HTML file??

Discussion in 'PHP' started by eshban, Dec 9, 2006.

  1. eshban

    eshban New Member

    Joined:
    Dec 6, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hello,

    Iam facing a small problem in PHP.

    I have some html code like

    HTML:
    
    <!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
     
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,646
    Likes Received:
    86
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    You can you regex to replace it! Match the src attribute and replace it with whatever you want.
     
  3. eshban

    eshban New Member

    Joined:
    Dec 6, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Did you provide any source code which helps me
     

Share This Page