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 Link to comment https://forums.phpfreaks.com/topic/44601-solved-fetch-information-from-other-website/ 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> Link to comment https://forums.phpfreaks.com/topic/44601-solved-fetch-information-from-other-website/#findComment-216774 Share on other sites More sharing options...
3s2ng Posted March 29, 2007 Author Share Posted March 29, 2007 Thanks alot Effigy. Link to comment https://forums.phpfreaks.com/topic/44601-solved-fetch-information-from-other-website/#findComment-217179 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.