<!DOCTYPE html>
<?php
   function _getDate($dateStr) {
      $tmpDate=$dateStr[0].$dateStr[1].$dateStr[2].$dateStr[3].$dateStr[5].$dateStr[6].$dateStr[8].$dateStr[9];
      return (integer)$tmpDate;
   }
   
   define('USER', 'jesse.turner@gatewaybaltic.com');
   define('TOKEN', 'reNaj8P1B4r3y9=fD8RaM0a4Lf30sdBda1d210we'); 
   require 'Solve360Service.php';
   
   $solve360Service = new Solve360Service(USER, TOKEN);
	$dateFrom=(integer)$_GET["d"];
   
   $cons = $solve360Service->searchContacts(array('layout' => '1', 
                  'searchmode' => 'Sany','searchvalue' => "",
                  'limit' => '99999', 'sortfield' => 'created', 'sortdir' => 'DESC','special' => 'OR'));
   
   $contacts=array();
   $pastDate=false;   
   foreach ($cons->children() as $ch) {
      if ($pastDate==false) {
         $dd=$ch->created;
         $conCreated=_getDate("$dd");
         if ($conCreated>=$dateFrom) {
            $conId=$ch->id;
            $conName=$ch->name;
            $conWebsite=$ch->website;
            $conCompany=$ch->company;
            $conEmail=$ch->businessemail;
            $conPhone=$ch->businessphonedirect;
            $conCountry=$ch->custom4698752;
            $conAssignedRef=$ch->assignedto;
            if (strlen($conName)>0) { 
               echo $conName.', ';
               $contacts[]=array("$conId","$conAssignedRef","$conCreated","$conName","$conPhone","$conEmail","$conWebsite","$conCountry",0,"$conCompany","");
            }
         } else $pastDate=true;
      }
 	}
 	//echo json_encode($contacts);
?>    
<html>
<body>
<p>test</p>
</body>
</html>