dilbertone Posted October 31, 2010 Share Posted October 31, 2010 good day dear freaks i want to parse the site - and get the results out of it: see this third overview-page therefore i need to loop over the line 2 - don ´ i!? <?php $data = file_get_contents('http://www.educa.ch/dyn/79363.asp?action=search'); $regex = '/Page 1 of (.+?) results/'; preg_match($regex,$data,$match); var_dump($match); echo $match[1]; ?> in order to get the details of the pages - see this first detail-page see this second detail-page see this third detail-page just help me with this seven-liner Quote Link to comment Share on other sites More sharing options...
rwwd Posted October 31, 2010 Share Posted October 31, 2010 Only one issue with your first line, and that is: file_get_contents will parse that URL into 1 single string, so your script wouldn't function anyway, I think that file() would be the better option as this will read the contents into an array, as for the rest of the logic, I'm not too sure what your trying to achieve, unless it's a sort of pagination?? Probably missed the point to the question; my apologies if I have.. Rw Quote Link to comment Share on other sites More sharing options...
dilbertone Posted October 31, 2010 Author Share Posted October 31, 2010 hi there hello dear rwwd i want to reconstruct the sub-page URLs. see here : http://www.educa.ch/dyn/79363.asp?action=search for($i=1;$i<=$match[1];$i++) { $url = "http://www.example.com/page?page={$i}"; // access new sub-page, extract necessary data } well this is what i want to. And now i need to have a good parser-script. Note: this is a tree-part-job: 1-. fetching the sub-pages 2. parsing them 3. storing the data in a mysql-db btw- parsing should be a part that can be done with DomDocument - What do you think? I need to combine the first part with tthe second - can you give me some starting points and hints to get this fetching-job done - and to process the data into a DomDocument-Parser-Job. I would love to discuss this with you here... Look forward to hear from you rwwd 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.