<?php
   $contacts=array();
   $filename = "contacts.txt";
   $handle = fopen($filename, "r");
   $contents = fread($handle, filesize($filename));
   fclose($handle);
   $data=explode(";",$contents);
   
   $contacts=array();
   for ($i=0;$i<count($data);$i+=9) {
      $conId=$data[$i];
      $conAssignedRef=$data[$i+1];
      $conCreated=$data[$i+2];
      $conName=$data[$i+3];
      $conPhone=$data[$i+4];
      $conEmail=$data[$i+5];
      $conWebsite=$data[$i+6];
      $conCountry=$data[$i+7];
      $conCompany=$data[$i+8];
      $contacts[]=array("$conId","$conAssignedRef","$conCreated","$conName","$conPhone","$conEmail","$conWebsite","$conCountry",0,"$conCompany","");
 	}
 	echo json_encode($contacts);
?>    