When I run the code below, it displays only the web page accessible through the last url listed in "domainslist.txt". It does not display the earlier web pages. 

For example, if "domainslist.txt" contains:

```
http://example[1].com
http://example[2].com
http://example[3].com

```

Then the code only displays the web page from example[3].com.

Why does it not display all three?

```
function url_get_contents($Url) {
        if (!function_exists('curl_init')) {
            die('CURL is not installed!');
        }
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $Url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $output = curl_exec($ch);
        curl_close($ch);
        return $output;
    }

    $urls = file("domainslist.txt", FILE_SKIP_EMPTY_LINES);

    foreach ($urls as $url) {

        echo(url_get_contents($url)); 

    }

```

NB If I create the array of URLs manually, like this:

```
$urls = array();
$urls[0] = "http://example[1].com";
$urls[1] = "http://example[2].com";
$urls[2] = "http://example[3].com";

```

then it works fine, displaying all 3 pages.

EDIT:

When I used `var_dump($urls);` there is a small difference between the results from the two different methods of forming the arrays. The first two URLs in the array created using `file()` have two extra characters reported in the string length - but the final URL (the one that displays) is the the right number of characters. However, when the array is created manually, there are no extra characters.