<?php
   define('USER', 'jesse.turner@gatewaybaltic.com');
   define('TOKEN', 'reNaj8P1B4r3y9=fD8RaM0a4Lf30sdBda1d210we'); 
   require 'Solve360Service.php';
   
   $solve360Service = new Solve360Service(USER, TOKEN);
	
	$startDate=$_GET["startDate"];
	//$startDate='20130401';
	$startDateNum=intval($startDate,10);
		
   $comps = $solve360Service->getAllCompanies();
   
   $companies=array();

   foreach ($comps->children() as $ch) {
      $compId=$ch->id;
      $compName=$ch->name;
      $compDate=$ch->created;
      $compDateStr=substr($compDate,0,4).substr($compDate,5,2).substr($compDate,8,2);
      $compDateNum=intval($compDateStr,10);
      if (strlen($compName)>0 && $startDateNum<=$compDateNum) $companies[]=array("$compId","$compName","$compDateStr",0);
   }
      
   echo json_encode($companies);
?>
