Example #1
2
<?php

// This will prevent any errors that occur from potentially displaying your username/password
error_reporting(0);
// This should properly display device names that contain special characters
header("Content-type: text/html; charset=utf-8");
// Include the FindMyiPhone class
include "class.findmyiphone.php";
// This is where we log in to iCloud
try {
    $fmi = new FindMyiPhone("username_goes_here", "password_goes_here");
} catch (Exception $e) {
    print "Error: " . $e->getMessage();
    exit;
}
// This will print out all the devices on your account so you can grab the device IDs
$fmi->printDevices();
// Find a device that is reporting its location and attempt to get its current location
foreach ($fmi->devices as $device) {
    if ($device->location->timestamp != "") {
        // Locate the device
        $location = $fmi->locate($device->ID);
        print "Device <B>" . $device->ID . "</B> is located at <I>" . $location->latitude . ", " . $location->longitude . "</I>";
        // Play a sound on the device
        $fmi->playSound($device->ID, "You've been located!");
        // Lock the device
        //$fmi->lostMode($device->ID, "You got locked out", "555-555-5555");
        break;
    }
}
function ios($msg)
{
    global $appleid, $applepass, $appledevice;
    include "findmyiphone.php";
    $fmi = new FindMyiPhone($appleid, $applepass);
    $fmi->playSound($appledevice, $msg);
    sleep(2);
}
function ios($msg)
{
    require_once "findmyiphone.php";
    $fmi = new FindMyiPhone(appleid, applepass);
    $fmi->playSound(appledevice, $msg);
}
<?php

include 'functions.php';
error_reporting(E_ALL);
ini_set("display_errors", "on");
if (isset($_COOKIE["HomeEgregius"])) {
    echo "Script to send IOS notifications<br/>";
}
if (isset($_REQUEST['bericht'])) {
    include "findmyiphone.php";
    $fmi = new FindMyiPhone($appleid, $applepass);
    $fmi->playSound($device, $_REQUEST['bericht']);
} else {
    ?>
<form action="#" method="get" id="form"><input type="text" name= "bericht" value="bericht" size="50"/><input type="submit" name="submit" value="Verzenden" /></form>
<?php 
}
<?php

// Include/funct
require_once dirname(__FILE__) . '/findmyiphone.class.php';
function d($m)
{
    echo "** D: {$m}\n";
}
// Create object:
$fms = new FindMyiPhone('*****@*****.**', 'password');
// Enable debug:
$fms->debug(true);
// Returns bool:
$login = $fms->login();
if ($login === true) {
    d('Login success');
    // Returns array
    $devices = $fms->devices();
    if (count($devices) > 0) {
        d('Got devices (' . count($devices) . ')');
        // Each device is iDevice object
        // 	$device->sendMsg(body, title, sound t/f);
        //	$device->sendLck();
    }
} else {
    d('Login failure');
}
<?php

error_reporting(0);
header("Content-type: text/html; charset=utf-8");
require_once "functions.php";
require_once "findmyiphone.php";
try {
    $fmi = new FindMyiPhone($appleid, $applepass);
} catch (Exception $e) {
    print "Error: " . $e->getMessage();
    exit;
}
$fmi->printDevices();