<?php
header("Content-type: text/x-json");
$fp = fopen("http://localhost/thd/web/uploads/tags.csv", "r");
while (($data = fgetcsv($fp)) != FALSE) {
  $line = "{sin: " . $data[0] .
    ",sout: " . $data[1] .
    ",tag: '" . $data[2] . "'" .
    ",user: '" . $data[3] . "'}";

  $lines[] = $line;
}
$result = "[" . join($lines,',') . "]";
echo $result;