I'm trying to process an array from data posted from a textbox.
I've written the following code to trim each new line and I have nearly everything working perfectly except one thing. I believe I need to iterate my numeric array through this GeoIP function:
$record = geoip_record_by_addr($gi,$value);
, but it only processes the last IP in the array, and not the entire thing.
My var_dump: string(12) "65.87.12.213" string(12) "13.15.200.36"
$gi = geoip_open("/tmp/GeoIPCity.dat",GEOIP_STANDARD);
$iips = explode("\n", $_POST["ip"]);
$iiips=array_map('trim',$iips);
foreach($iiips as $key => $value) {
$record = geoip_record_by_addr($gi,$value);
}
print $record->city . "\n";
print $record->region . " " . "\n";
print $record->country_name . "\n";
$record1 = $record->city . " " . $record->region . " " . $record->country_name;
var_dump($record1);
Is there anybody that can please help?