<?php

// $domains = [
//     'bigtimberbuilders.com',
//     'naturalelementhomes.com'
// ];

$emailToFind = 'randy@naturalelementhomes.com';

// foreach ( DOMAINS as $domain ) {
    // $username = explode('@', $emailToFind)[0];
    // $emailToFind = "$username@$domain";

    // echo "<br>looking for $username@$domain<br>";

    $ch = curl_init();
    // curl_setopt($ch, CURLOPT_URL, "https://api.smartsheet.com/2.0/users?email=$emailToFind&includeAll=true");
    curl_setopt($ch, CURLOPT_URL, "https://api.smartsheet.com/2.0/users?includeAll=true");
    curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer qJc6jnLsHoqznwCbkApNwLMQamt6ITcykpgen", 'Content-Type: application/json']);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    $response = json_decode(curl_exec($ch));
    curl_close($ch);

    echo "<pre>";
    print_r($response);
    echo "</pre>";

    // if ( $response->data ) {
    //     echo "<br>found<br>";
    //     break;
    // }
// }