We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,394 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Scraping HTML from a Table

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

2
Contributors
1
Reply
17 Hours
Discussion Span
1 Year Ago
Last Updated
2
Views
danielsikes
Light Poster
25 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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

pritaeas
Posting Prodigy
Moderator
9,316 posts since Jul 2006
Reputation Points: 1,178
Solved Threads: 1,467
Skill Endorsements: 86

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.1140 seconds using 2.7MB