tags:

views:

29

answers:

1

howdy - good morning Community!

i want to parse the site - and get the results out of it:

see this URL here - a swiss-server - head over to this site where i want to loop over - see this page here - i want to access the sub-pages in order to get the information that is shown in the "detail-pages!"

therefore i need to loop over the line 2 - don ´ i!?

 <?php
 $data = file_get_contents('[here we have to add the URL ');
 $regex = '/Page 1 of (.+?) results/';
 preg_match($regex,$data,$match);
 var_dump($match);
 echo $match[1];
 ?>

in order to get the details of the sub-pages - plz have a look above!!

just help me with this seven-liner ;)

Fritz The Cat

A: 

I guess you want to reconstruct the sub-page URLs.

for($i=1;$i<=$match[1];$i++)
{
  $url = "http://www.example.com/page?page={$i}";
  // access new sub-page, extract necessary data
}
esryl
hello esryl many many thanks - thats it! You are g reat! Mille Grazie! Fritz The Cat!
fritz the cat
btw - how would a parser-part look like-. If i get the pages i want to do parsing with DomDocument. That seems to be a good parser-solution!
fritz the cat
I personally use PHP Simple HTML DOM Parser: http://simplehtmldom.sourceforge.net/ as it is nice and easy to use for most things.
esryl
hello Esryl - many many thanks! I will have a closer look at this sourceforge-Project! I guess that this will help me! Mille Grazie! Fritz-The-Cat
fritz the cat