<?




function aweberSubscribe($email, $name, $date, $geo, $lng, $link) {

    // Create a Guzzle client
	$client = new GuzzleHttp\Client();
	
	// Refresh token
    aweberRefresToken($client);

    // Load credentials
    $credentials = parse_ini_file('credentials.ini');
    $accessToken = $credentials['accessToken']; 
       
    $data = array(
        'email' => $email,
        'name' => $name,
        'update_existing' => "true",
        'custom_fields' => array(
            'date' => $date,
            'geo' => $geo,
            'lng' => $lng,
            'link' => $link,
        ),
    );
    $client->post(AWEBER_LIST_URL, [
        'json' => $data, 
        'headers' => ['Authorization' => 'Bearer ' . $accessToken]
    ]);
}
?>