PHP code example of valerian / findmyiphone

1. Go to this page and download the library: Download valerian/findmyiphone 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/ */

    

valerian / findmyiphone example snippets


$findMyIphone = new Valerian\FindMyIphome('icloud username', 'icloud password');
$devices = $findMyIphone->getDevices();
foreach ($devices as $device) {
    $location = $device->getLocation();
    if ($location) {
        $latitude = $location->getLatitude();
        $latitude = $location->getLongitude();
    }
}



$findMyIphone = new Valerian\FindMyIphome('icloud username', 'icloud password');
$device = $findMyIphone->getDevice('deviceDisplayName');
$location = $device->getLocation();
if ($location) {
    $latitude = $location->getLatitude();
    $latitude = $location->getLongitude();
}