<?php
include 'myfit_class.php';

$myfit_class = new myfit_class();


    $email = 'ameye@chiefsoft.com';
  //  $email = 'ses66181+merms8455@gmail.com';
  //  $email = 'ses66181+merms6214@gmail.com';
   
   
    $data['username'] = $email;
    $data['password'] = 'mermsemr';
    $data['loc']  = "38.101.241.200";
    $data['sessionid'] = rand(10000,99999)."A".rand(10000,99999); // dummy for a start

$out = array();
$ret = $myfit_class->myfit_api("login",$data,$out);

if (is_array($out) 
      && array_key_exists('session_token',$out) 
        && $out['session_token'] != '') {
    echo 'Save the session for other use - you will need it';
    $myfile = fopen("../../writable/myfit_session.txt", "w") or die("Unable to open file!");
        fwrite($myfile, $out['session_token']);
        fwrite($myfile, "\n");
        fwrite($myfile, $out['member_id']);
        fwrite($myfile, "\n");
        fwrite($myfile, $out['guid']);
   fclose($myfile);
}

?>