Scraping info out of a text file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ChrisF79
Forum Commoner
Posts: 26
Joined: Tue Apr 01, 2008 8:26 pm

Scraping info out of a text file

Post by ChrisF79 »

Greetings:

I am a Realtor (and know some PHP) and instead of manually adding listings to my site, I want to just scrape the info from the MLS. I checked and this is allowed if I know how to do it. At any rate, I've pasted some of the code below and what I'm looking to get are things like ML#: as a variable and then capture 208027565 as the value. The code is definitely not pretty and I'm not sure how it can be done. I was thinking of cleaning it up with str_replace() but that might be the wrong way to go. I'd love to hear how the experts would do it.

Thanks in advance for any help or guidance you can provide!

Code: Select all

<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="490" align="left" valign="top">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10" align="left" valign="top"></td>
 
<td width="85" align="left" valign="top" class='label'>ML#:</td>
 
<td width="175" align="left" valign="top">208027565</td>
 
<td width="85" align="left" valign="top" class='label'>Status:</td>
 
<td width="155" align="left" valign="top">A-Active</td>
</tr>
 
<tr>
<td width="10" align="left" valign="top"></td>
 
<td width="85" align="left" valign="top" class='label'>Address:</td>
 
<td width="175" align="left" valign="top"><a href=
"javascript&#058;window_open('http://maps.google.com/maps?f=d&hl=en&geocode=&saddr=&z=12&om=1&daddr=8891+LELY+ISLAND+CIR+NAPLES++Florida+34113-2610',%20725,%20525)"
style='color: 0054A6'>8891 LELY ISLAND CIR</a></td>
 
<td width="85" align="left" valign="top" class='label'>(GEO) Area:</td>
 
<td width="155" align="left" valign="top">NA19</td>
</tr>
 
<tr>
<td width="10" align="left" valign="top"></td>
 
<td width="85" align="left" valign="top" class='label'></td>
 
<td width="175" align="left" valign="top">NAPLES,&nbsp;Florida&nbsp;34113-2610</td>
 
<td width="85" align="left" valign="top" class='label'>Subdivision:</td>
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Scraping info out of a text file

Post by josh »

I'd use regular expressions. In fact you almost have to. Maybe we could work out something mutually beneficial, did they say if you're allowed to give your programmer a copy of the data too?
Post Reply