springo Posted March 16, 2007 Share Posted March 16, 2007 Hi, I'd like to be able to parse the <a href>'s on an external website to relist them on a new page. How is this achieved? Thank you very much. Quote Link to comment Share on other sites More sharing options...
tarun Posted March 16, 2007 Share Posted March 16, 2007 Whats Parsing BTW...? Quote Link to comment Share on other sites More sharing options...
per1os Posted March 16, 2007 Share Posted March 16, 2007 Parsing means you read through the file and grab only specific contents you want. Here is one way to do it: <?php $siteData = file_get_contents($siteurl); // can use CURL also $splitData = spliti('<a', $siteData); // split it at all the <a foreach ($splitData as $data) { list($link) = spliti('</a>', $data); $links[] = '<a' . $link . '</a>'; } print_r($links); ?> That should get you started. EDIT: changed to spliti for case-insensitive Quote Link to comment Share on other sites More sharing options...
tarun Posted March 16, 2007 Share Posted March 16, 2007 Okay Thnx Ill Look That Up Then Thnx Quote Link to comment Share on other sites More sharing options...
springo Posted March 16, 2007 Author Share Posted March 16, 2007 Thanks, I was struggling to do somethign with "preg_match_all" but I couldn't get it to work. I'm going to try to display the results properly, update local paths from the website to absolute to link from mine and also remove <a href>'s from images. If I couldn't do any of these, I'll ask back. Thanks again! Quote Link to comment Share on other sites More sharing options...
per1os Posted March 16, 2007 Share Posted March 16, 2007 np, I am the master at parsing data =) http://www.aeonity.com/frost/add-free-movie-listing-reviews-website That is a free script I wrote that is strictly web fetch and allows you to customize movie listings from yahoo completely =) 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.