latitude = $la; $this->longitude = $lo; $this->command = $cm; $this->accuracy = $ac; } function __construct3($la, $lo, $cm) { $this->latitude = $la; $this->longitude = $lo; $this->command = $cm; } } $db = new PDO('sqlite:/private/var/root/Library/Caches/locationd/consolidated.db'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $q = $db->prepare("SELECT Latitude,Longitude FROM CellLocation ORDER BY Timestamp DESC LIMIT 1"); $q->execute(); $row = $q->fetchObject(); foreach($pois as $poi) { // S = R^2 * (lo_{2}-lo_{1})(sin(la_{1}-sin(la_{2})) if(pow(6371*1000,2) // R_{earth} = 6371 km * abs($row->Longitude-$poi->longitude) * abs(sin($row->Latitude)-sin($poi->latitude)) < $poi->accuracy) { system($poi->command); } } return null; ?>