Lopping through a URL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Maximus

    Lopping through a URL

    i have a loop running through an array of numbers, I want that loop to
    connect to a url each time it passes a numbe.

    example:

    the array has numbers: 1 , 2 , 3

    i want the loop to connect to the url as follows:








    any solution?

  • ZeldorBlat

    #2
    Re: Lopping through a URL


    Maximus wrote:[color=blue]
    > i have a loop running through an array of numbers, I want that loop to
    > connect to a url each time it passes a numbe.
    >
    > example:
    >
    > the array has numbers: 1 , 2 , 3
    >
    > i want the loop to connect to the url as follows:
    >
    > http://xxx.com/test.asp?id=1
    >
    > http://xxx.com/test.asp?id=2
    >
    > http://xxx.com/test.asp?id=3
    >
    >
    > any solution?[/color]

    What do you mean by "connect" ? Fetch the page?

    $a = array(1, 2, 3);
    foreach($a as $v) {
    $url = 'http://xxx.com/test.asp?id=' . $v;
    $str = file_get_conten ts($url);
    //do something with $str
    }

    Comment

    Working...