function _getIPList(&$ipList) {
$hosts = array(
'www.paypal.com',
'notify.paypal.com',
'ipn.sandbox.paypal.com'
);
$ipList = array();
foreach($hosts as $host) {
$ips = gethostbynamel($host);
if(!empty($ips)) {
if(empty($ipList))
$ipList = $ips;
else
$ipList = array_merge($ipList, $ips);
}
}
if(empty($ipList))
return $ipList;
$newList = array();
foreach($ipList as $k => $ip) {
$ipParts = explode('.', $ip);
if(count($ipParts) == 4) {
array_pop($ipParts);
$ip = implode('.', $ipParts) . '.*';
}
if(!in_array($ip, $newList))
$newList[] = $ip;
}
return $newList;
}