3s2ng Posted March 28, 2007 Share Posted March 28, 2007 Hello Freaks, Basis: http://www.onemotoring.com.sg/publish/onemotoring/en/on_the_roads/parking/parking_rates/downtown_rates.html I just want to get the carpark rates from other website. Actually I've already manually copied some of the rates around 100's and placed it in an excel sheet then my friend told me that theirs an easy way to copy those info using some PHP scripts. I've search the web but I cant find what is the term for that .Now I'm here hoping that somebody can help me. Can anybody help me create this script? What are the things that I need to do. Thanks, MARK Quote Link to comment Share on other sites More sharing options...
effigy Posted March 28, 2007 Share Posted March 28, 2007 <pre> <?php // Load page into string. $page = file_get_contents('http://www.onemotoring.com.sg/publish/onemotoring/en/on_the_roads/parking/parking_rates/downtown_rates.html'); // Split the page by what we need. $wanted_content = preg_split('/(?=Parking Rates in Car Parks Downtown)/', $page); // What we need is the last part. $wanted_content = array_pop($wanted_content); // Match the content of 5 columns. preg_match_all('% <td[^>]*>(.*?)</td>\s* <td[^>]*>(.*?)</td>\s* <td[^>]*>(.*?)</td>\s* <td[^>]*>(.*?)</td>\s* <td[^>]*>(.*?)</td> %ix', $wanted_content, $matches, PREG_SET_ORDER); // Toss the header row. array_shift($matches); // Toss the full matches. foreach ($matches as &$match) { array_shift($match); } // Show results. print_r($matches); ?> </pre> Quote Link to comment Share on other sites More sharing options...
3s2ng Posted March 29, 2007 Author Share Posted March 29, 2007 Thanks alot Effigy. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.