开发者

Loop constructing the URLs in a little parser-script: a seven liner needs some help!

howdy - good morning Community!

i want to parse the site - and get the results out开发者_如何学JAVA 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


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
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜