1. Go to this page and download the library: Download lounisbou/cell-location library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lounisbou / cell-location example snippets
use Lounisbou\CellLocation\CellLocator;
use Lounisbou\CellLocation\OpenCellIDService;
use Lounisbou\CellLocation\Enums\RadioType;
tor
$cellLocator = new CellLocator($openCellIdService);
// Create CellData object
$cellData = new CellData(
mcc: 260,
mnc: 2,
lac: 10250,
cellId: 26511,
radioType: RadioType::GSM
);
// Find the location based on cell tower info
$location = $cellLocator->getLocation($cellData);
if ($location) {
echo "Latitude: {$location->latitude}, Longitude: {$location->longitude}, Accuracy: {$location->accuracy}" . PHP_EOL;
} else {
echo "Location not found." . PHP_EOL;
}
use Lounisbou\CellLocation\CellLocator;
use Lounisbou\CellLocation\OpenCellIDService;
use Lounisbou\CellLocation\Enums\RadioType;
tor
$cellLocator = new CellLocator($openCellIdService);
// Create CellData objects
$cellData = new CellData(
mcc: 260,
mnc: 2,
lac: 10250,
cellId: 26511,
radioType: RadioType::GSM
);
$cellData2 = new CellData(
mcc: 260,
mnc: 2,
lac: 10250,
cellId: 21771,
radioType: RadioType::GSM
);
$cellData3 = new CellData(
mcc: 260,
mnc: 2,
lac: 58120,
cellId: 41964,
radioType: RadioType::GSM
);
// Find the location based on cell tower info
$location = $cellLocator->getTriangulatedLocation([$cellData1, $cellData2, $cellData3]);
if ($location) {
echo "Latitude: {$location->latitude}, Longitude: {$location->longitude}, Accuracy: {$location->accuracy}" . PHP_EOL;
} else {
echo "Location not found." . PHP_EOL;
}
bash
composer dump-autoload
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.