문제

I have a set of urls on the form of

http://www.domain.com/directory/page.php?id=xxxx

How do I iterate through the different ids and save the resulting pages?

도움이 되었습니까?

해결책

for($i=1;$i<100;$i++)
{
   $results[]=file_get_contents("http://www.domain.com/directory/page.php?id=$i");
}
print_r($results);

Or if you already have the ids in any array you could loop over them

foreach($arrayOfIDS as $id)
{
   $results[]=file_get_contents("http://www.domain.com/directory/page.php?id=$id");
}
print_r($results);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top