Page 1 of 1

Scraping info out of a text file

Posted: Thu Feb 19, 2009 1:47 pm
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>

Re: Scraping info out of a text file

Posted: Thu Feb 19, 2009 3:54 pm
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?