<?php

include "config.php";
include "pdo.class.php";
$pdo = Db::singleton();
require_once "Services/HighriseAPI.class.php";
$highrise = new HighriseAPI();
$highrise->debug = false;
$highrise->setAccount($highrise_account);
$highrise->setToken($highrise_apikey);
$people = $highrise->findPeopleBySearchCriteria(array('phone' => $_REQUEST['From']));
if (count($people)) {
    $p = $people[0];
    $name = $p->getFirstName() . ' ' . $p->getLastName();
    $now = time();
    $sql = "INSERT INTO calls SET caller_name='{$name}',caller='{$_REQUEST['From']}', call_time='{$now}'";
    $pdo->exec($sql);
} else {
    $now = time();
    $sql = "INSERT INTO calls SET caller='{$_REQUEST['From']}', call_time='{$now}'";
    $pdo->exec($sql);
}
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<Response>
	<Gather action="input.php" numDigits="1">
		<Say>Welcome to my pretend company.</Say>
		<Say>For store hours, press 1.</Say>
		<Say>For directions, press 2</Say>
		<Say>To speak to an agent, press 3.</Say>
<?php

require_once "../lib/HighriseAPI.class.php";
if (count($argv) != 3) {
    die("Usage: php users.test.php [account-name] [access-token]\n");
}
$hr = new HighriseAPI();
$hr->debug = false;
$hr->setAccount($argv[1]);
$hr->setToken($argv[2]);
print "Finding my user...\n";
$user = $hr->findMe();
print_r($user);
print "Finding all users...\n";
$users = $hr->findAllUsers();
print_r($users);
<?php

require_once "../lib/HighriseAPI.class.php";
if (count($argv) != 3) {
    die("Usage: php tags.test.php [account-name] [access-token]\n");
}
$highrise = new HighriseAPI();
$highrise->debug = false;
$highrise->setAccount($argv[1]);
$highrise->setToken($argv[2]);
$people = $highrise->findPeopleBySearchTerm("Personality Changer");
foreach ($people as $p) {
    $p->delete();
}
$person = new HighrisePerson($highrise);
$person->setFirstName("Personality");
$person->setLastName("Changer");
$person->addEmailAddress("*****@*****.**");
$person->save();
print "Person ID is: " . $person->getId() . "\n";
$person->addEmailAddress("*****@*****.**");
$person->save();
print "Person ID after save is: " . $person->getId() . "\n";
print_r($person);
$people = $highrise->findPeopleBySearchTerm("Personality Changer");
print_r($people);
$person->delete();