a loop constructing the URLs and make PHP to fetch up to 100 pages [ a seven liner]
| From: | "jobst müller" | Date: | Sat, 30 Oct 2010 14:21:06 +0000 |
| Subject: | a loop constructing the URLs and make PHP to fetch up to 100 pages [ a seven liner] | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-309149@lists.php.net to get a copy of this message | ||
dear list - good Morning!
i want to parse the site - and get the results out of it:
http://www.educa.ch/dyn/79363.asp?action=search
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 -
http://www.educa.ch/dyn/79376.asp?id=4438
http://www.educa.ch/dyn/79376.asp?id=53
and so forth - well i need a foreach statement in line two - don´ t i!?
just help me with this seven-liner ;)
on a sidenote: measuring code in terms of how many lines it took to write is
a Perl-coder-attitude. Only Perl programmers care about that and i find it hard
it is to read Perl code.
love to hear from you
___________________________________________________________
GRATIS! Movie-FLAT mit über 300 Videos.
Jetzt freischalten unter http://movieflat.web.de