<?php
   define('USER', 'jesse.turner@gatewaybaltic.com');
   define('TOKEN', 'reNaj8P1B4r3y9=fD8RaM0a4Lf30sdBda1d210we'); 
   require 'Solve360Service.php';
   
   $solve360Service = new Solve360Service(USER, TOKEN);

   $blogId=$_GET["b"];
   $importId=$_GET["i"];
   
   $blog = $solve360Service->getProjectblog($blogId);
   $comps=array();    
   foreach ($blog->relateditems->children() as $comp) {
      if ($comp->typeid==40) {
         $compName=$comp->name;
         $comps[]="$compName";
      }
   }
   
   $compList = $solve360Service->searchCompanies(array('layout' => '1','filtermode' => 'category','filtervalue' => "$importId",'special' => 'OR','limit' => '5000'));
   $new=array();
   foreach ($compList->children() as $ch) {
      $id=$ch->id;
      $name=$ch->name;
      $created=$ch->created;         
      if (strlen($name)>0) $new[]=array("$name","$id","$created");
   }
   
   echo json_encode(array($comps,$new));
   
   
   /*
   -> id75389597 =
-> -> id = 75389597
-> -> name = AFCO Distribution
-> -> typeid = 40
-> -> parentid = 16728049
-> -> parentcn = GatewayBaltic
-> -> flagged =
-> -> mainaddress = 11016 E. Montgomery Dr. Spokane Valley, WA 99206
-> -> custom4593431 = USA
-> -> custom4620793 = afco@afcodistribution.com
-> -> website = www.afcodistribution.com
-> -> custom4593432 = Garden and animal products
-> -> custom4593433 = Wholesaler
-> -> background = AFCO Distribution is a wholesale distribution company that serves over 800 Garden, Feed and Pet Supply retailers in Washington, Oregon, Idaho, Montana, Nevada, Utah, Wyoming and Alaska. AFCO distributes over 7,000 products including animal feeds, Garden and Nursery supplies, wildlife products, pet food and pet supplies, fencing and livestock equipment. Their assortment includes various bird feeders: https://shop.afcodistribution.com/departments/feeders-579.html
-> -> phone = +1 800 538 8700
-> -> custom5722951 = Prodeco USA
-> -> created = 2013-03-13T16:48:45+00:00
-> -> viewed = 2013-07-17T06:14:53+00:00
-> -> updated = 2013-04-02T14:26:52+00:00
*/
   
?>


