I need to repeat this
do {
$QUERY = "/member?id=".$counter."&action=refresh";
$URL = $HTTP.$HTTPUSER.":".$HTTPPASS."@".$HTTPSERVER.":".$HTTPPORT.$QUERY;
$xml = file_get_contents($URL);
$data = new SimpleXMLElement($xml);
$test_ip = (string)$data->c1;
$dnsip = explode('<br>', $test_ip);
$ext_ip = strip_tags($dnsip[1]);
if ($ext_ip != "127.0.0.1" && $ext_ip != "localhost") {
$dns = strip_tags($dnsip[0]);
echo "$dns $ext_ip <br>";
}
$counter +=1;
} while (!empty($data));
as many times as there are values inside an array, so i tried to add this
$ports = array('2001','2002','2003');
foreach ($ports as $HTTPPORT) {
echo "$HTTPPORT<br>";
$counter = 1;
do {
$QUERY = "/member?id=".$counter."&action=refresh";
$URL = $HTTP.$HTTPUSER.":".$HTTPPASS."@".$HTTPSERVER.":".$HTTPPORT.$QUERY;
$xml = file_get_contents($URL);
$data = new SimpleXMLElement($xml);
$test_ip = (string)$data->c1;
$dnsip = explode('<br>', $test_ip);
$ext_ip = strip_tags($dnsip[1]);
if ($ext_ip != "127.0.0.1" && $ext_ip != "localhost") {
$dns = strip_tags($dnsip[0]);
echo "$dns $ext_ip <br>";
}
$counter +=1;
} while (!empty($data)); }
The problem is that it executes the script with only first port number (2001), and I can't discover why.