jmac2501 Posted April 25, 2007 Share Posted April 25, 2007 Hey- I run a real estate website and i show house listings on our website. I am looking for a way to gather info from our sorce website and save them to my database. here is an example of the website i need to get info from. http://www.metrolistmls.com/cgi-bin/GetOneR.cfm?MLSNum=60131588 from this page i need the top most picture, address, beds, bath, Square feet, and agent values. Is there a way to gather all this info and insert in into my database? any help would be great. Link to comment https://forums.phpfreaks.com/topic/48542-get-info-from-another-website/ Share on other sites More sharing options...
Psycho Posted April 25, 2007 Share Posted April 25, 2007 Yes, it's called screen scraping. You will need to create the rules for what data to pull. Here is a class written by an associate of mine: http://www.codetoad.com/forum/26_24777.asp Link to comment https://forums.phpfreaks.com/topic/48542-get-info-from-another-website/#findComment-237647 Share on other sites More sharing options...
otuatail Posted April 25, 2007 Share Posted April 25, 2007 Is this your own website? do you have total access to it and the database? If it is you can export it to your hard disc localy. Need more info. Des. Link to comment https://forums.phpfreaks.com/topic/48542-get-info-from-another-website/#findComment-237653 Share on other sites More sharing options...
jmac2501 Posted April 25, 2007 Author Share Posted April 25, 2007 You will need to create the rules for what data to pull. where and how do i do that. I looked but couldn't find it. I did get it to pull up the website though. Link to comment https://forums.phpfreaks.com/topic/48542-get-info-from-another-website/#findComment-238071 Share on other sites More sharing options...
Psycho Posted April 25, 2007 Share Posted April 25, 2007 You will need to create the rules for what data to pull. where and how do i do that. I looked but couldn't find it. I did get it to pull up the website though. You will need to inspect the layout of the page to find consistent rules for each piece of data. Hopefully, the pages are consistent - if not you will have real problems. For example, let's say you want to get the number of bedrooms. A view of the page you posted shows that the bedrooms in the code is writen like this: <td width="16%" class="FormTitle">Bedrooms</td> <td width="14%" bgcolor="#f0f0f0">2</td> So, in the text of the body that is returned you could do a search for ]<td width="16%" class="FormTitle">Bedrooms</td> and then grab the value in the cell directly following that text. You would neet to create similar logic for all the other pieces of data you need. The class also has some built in functions for dealing with table data. I have not used it myself, so I can't give any specific advice. I would try using those methods first. Link to comment https://forums.phpfreaks.com/topic/48542-get-info-from-another-website/#findComment-238387 Share on other sites More sharing options...
jmac2501 Posted April 29, 2007 Author Share Posted April 29, 2007 The pages are consistent. I have been trying to use diffrent string functions to search and pull these values with no luck. can any one help me out with the code i should use for this and an example would be great. i need it to do this: For example, let's say you want to get the number of bedrooms. A view of the page you posted shows that the bedrooms in the code is writen like this: <td width="16%" class="FormTitle">Bedrooms</td> <td width="14%" bgcolor="#f0f0f0">2</td> So, in the text of the body that is returned you could do a search for ]<td width="16%" class="FormTitle">Bedrooms</td> and then grab the value in the cell directly following that text. You would neet to create similar logic for all the other pieces of data you need. The class also has some built in functions for dealing with table data. I have not used it myself, so I can't give any specific advice. I would try using those methods first. this is what i got so far: <?php error_reporting(E_ALL ^ E_NOTICE); require_once(dirname(__FILE__).'/class_http.php'); $h = new http(); $h->dir = "/home/foo/bar/"; if (!$h->fetch("http://www.metrolistmls.com/cgi-bin/GetOneR.cfm?MLSNum=70003411")) { echo "<h2>There is a problem with the http request!</h2>"; echo $h->log; exit(); } $msft_stats = http::table_into_array($h->body, "$", 1, not_null); /* Print out the array so you can see the stats data. */ echo "<pre>"; print_r($msft_stats); echo "</pre>"; Link to comment https://forums.phpfreaks.com/topic/48542-get-info-from-another-website/#findComment-240981 Share on other sites More sharing options...
jmac2501 Posted April 30, 2007 Author Share Posted April 30, 2007 Any help. :'( Link to comment https://forums.phpfreaks.com/topic/48542-get-info-from-another-website/#findComment-241365 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.