<?php
   define('USER', 'jesse.turner@gatewaybaltic.com');
   define('TOKEN', 'reNaj8P1B4r3y9=fD8RaM0a4Lf30sdBda1d210we'); 
   require 'Solve360Service.php';
   
   $solve360Service = new Solve360Service(USER, TOKEN);
	   
   $comps = $solve360Service->searchCompanies(array('layout' => '1', 
                  'searchmode' => 'Sany','searchvalue' => "",
                  'limit' => '99999', 'sortfield' => 'created', 'sortdir' => 'DESC','special' => 'OR'));
   
   $companies=array();

   foreach ($comps->children() as $ch) {
      $compId=$ch->id;
      $compName=$ch->name;
      $compWebsite=$ch->website;
      $compEmail=$ch->custom4620793;
      $compPhone=$ch->phone;
      $compCountry=$ch->custom4593431;
      $compAssignedRef=$ch->assignedto;
      if (strlen($compName)>0) $companies[]=array("$compId","$compAssignedRef",0,"$compName","$compPhone","$compEmail","$compWebsite","$compCountry",0,0,"?");
   }

 	echo json_encode($companies);
?>