Page 1 of 1

while and for

Posted: Wed Oct 06, 2010 4:25 am
by fer0an
hello
I want using while and for in my code anyone can help me?
I want download a webpage using get_content.
this page have 10 sub link and I want them.
so I use this codes :

Code: Select all

//number of website pages
     $i=1;
     while ($i<=4)
     {
//download a webpage
$maincatst = file_get_contents($catlink.$i);
$i++;

//number of sub link in a page
for ($j=1;$j<=10;$j++)

{
// download sub link content
$main_post_str = file_get_contents($link);
but I can't get them
my result is :
downloaded page 1 and first sub link then page 2 and first sub link ...page 4 and first sublink.
anyone can help me to download page 1 and 10 sub link then ....page 4 and 10 sub link?


thank you

Re: while and for

Posted: Wed Oct 06, 2010 7:34 am
by Bind