Struggling to get subscribersGetIsSubscribed to work

Hi there.
I would appreciated any help that anyone can provide me. As I have been struggling with the PHP API for some time now in trying to get a php form to work as required.

Basically what I'm trying to do is get a form that on submit checks to see if a email is already subscribed.
If they are, they get told they are already on a list.
If not, they get added to the list.

However the code that I think should work. Just seems to ignore the if statements. And ultimately I think it times out.

if(isset($_POST['email'])) {

$api_key = 'XXXXXXXXXXXXX';
$client_id = 'XXXXXXXXXXXXX';
$campaign_id = null;
$list_id = 'XXXXXXXXXXXXX';
$cm = new CampaignMonitor( $api_key, $client_id, $campaign_id, $list_id );

$name = $_POST["name"];
$email = $_POST["email"];
$hotel = $_POST["hotel"];

// check if the new subscriber already exists
$result = $cm->subscribersGetIsSubscribed($email, $list_id);

if ($result['anyType'] == "True") { 
echo "<p><strong>This person IS on your subscriber list</p>"; 
} else { 
// Add to Database with Custom Fields
$result = $cm->subscriberAddWithCustomFields($email, $name, $hotel);
echo "<p>This person is NOT on your subscriber list</p>"; 

if($result['Result']['Code'] == 0)
        echo '<p>Success</p>';
        echo 'Error : ' . $result['Result']['Message'];

} else {

<form action="<?php echo $PHP_SELF; ?>" method="post">
<label for="name">Name:</label>
<input type="text" name="name" id="name" size="25" />
<label for="email">Email Address:</label>
<input type="text" name="email" id="email" size="25" />
<label for="hotel">Hotel:</label></span>
<input type="text" name="hotel" id="hotel" size="25" />
<span class="button"><input type="submit" value="Subscribe" /><

<?php } ?>

Join 150,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free