1.11M Members

Scraping HTML from a Table

 
0
 

Hi,

<table class="info">
               <thead>
                  <tr>
                     <th>Mailing Address</th>
                     <th>Location Address</th>
                  </tr>
               </thead>
               <tbody>
                  <tr>
                     <td><address>123 Somewhere ST.<br/>Somewhere, CA 123456</address></td>
                     <td><address>123 Anotherplace Ln.<br/>Somewhere Else, CA 123434</address><br/></td>
                  </tr>
               </tbody>
            </table>
         </div>

         <h3>Information</h3>
         <div class="blockContent borderedContent">
            <table class="entryForm">
   <tbody>
      <tr>
         <th>Website:</th>
         <td>http://somewebsitehere.com</td>
      </tr>
      <tr>
         <th>Segment 1:</th>
         <td>SomeInfo Here</td>
      </tr>
      <tr>
         <th>Email:</th>
         <td><a class="mailLink" href="mailto:someone@gmail.com">someone@gmail.com</a></td>
      </tr>
      <tr>
         <th>Phone:</th>
         <td>123-456-7890</td>
      </tr>
      <tr>
         <th>Language(s):</th>
         <td>English</td>
      </tr>
   </tbody>
</table>

I need help on reading this table.
I would like it if I could have 7 variables

$locationAddress
$mailingAddress
$websiteUrl
$segment1
$email
$phone
$language

Can someone show me how to read this type of table and create those variables? I have been working on this for 2 days and can't figure this out. So I figured I would see what someone else could help me with.

Thanks,

-danielsikes

 
0
 

If your file is valid XML then you could use DOMDocument and DOMXPath to read your values.

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: