<?php
function getext($ip)
	{
	$ch = curl_init("http://avantec:admin@$ip/ConfSIPAccounts1Page.asp");
//curl_setopt ($ch, CURLOPT_COOKIEJAR, COOKIE_FILE); 
	//echo($ch);
	curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
//curl_setopt($ch, CURLOPT_HEADER, true);
	$remote=curl_exec ($ch);
	curl_close($ch);
	//echo($remote);
	$ext="---";
	if ($remote!=false)
		{
		$t1=explode("id=\"UserIdValue\" value=\"", $remote);
		$t2=explode("\"></TD></TR>", $t1[1]);
		$ext=$t2[0];
		}
	return $ext;
	}
$ip=$_GET["ip"];
echo(getext($ip));
?>