diff --git a/api/search.php b/api/search.php index f154f9a..6922611 100644 --- a/api/search.php +++ b/api/search.php @@ -1 +1 @@ -
Tkp
', $result); $results = explode('', $resultsb[1]); $rows = explode('', $results[0]); //Adds each row to the result array $i = 1; $length = count($rows); $results = array(); while($i < $length) { $values = explode('', $rows[$i]); //var_dump($values); $name = explode('', $values[1]); $ean = explode('', $values[2]); $store = explode('', $values[3]); $category = explode('', $values[4]); $starchb = explode('', $starchb[1]); switch($starch[0]) { case "#ffff66": $starch[0] = 3; //No data break; case "#ff6666": $starch[0] = 2; //Contains starch from wheat break; case "#66ff66": $starch[0] = 1; //Contains no starch from wheat break; } $lactoseb = explode('', $lactoseb[1]); switch($lactose[0]) { case "#ffff66": $lactose[0] = 3; //No data break; case "#ff6666": $lactose[0] = 2; //Contains lactose break; case "#66ff66": $lactose[0] = 1; //Contains no lactose break; } $bsmb = explode('#000000">', $category[3]); $bsm = explode('', $values[5]); $dlc = explode('', $values[6]); $source = explode('$d) $ret[$i] = utf8_encode_all($d); return $ret; } header("Content-type: application/x-json"); echo json_encode(array('api_version' => 0.1, 'results' => utf8_encode_all($results))); ?> \ No newline at end of file +
Tkp
', $result); $results = explode('', $resultsb[1]); $rows = explode('', $results[0]); //Adds each row to the result array $i = 1; $length = count($rows); $results = array(); while($i < $length) { $values = explode('', $rows[$i]); //var_dump($values); $name = explode('', $values[1]); $ean = explode('', $values[2]); $store = explode('', $values[3]); $category = explode('', $values[4]); $starchb = explode('', $starchb[1]); switch($starch[0]) { case "#ffff66": $starch[0] = 3; //No data break; case "#ff6666": $starch[0] = 2; //Contains starch from wheat break; case "#66ff66": $starch[0] = 1; //Contains no starch from wheat break; } $lactoseb = explode('', $lactoseb[1]); switch($lactose[0]) { case "#ffff66": $lactose[0] = 3; //No data break; case "#ff6666": $lactose[0] = 2; //Contains lactose break; case "#66ff66": $lactose[0] = 1; //Contains no lactose break; } $bsmb = explode('#000000">', $category[3]); $bsm = explode('', $values[5]); $dlc = explode('', $values[6]); $source = explode('$d) $ret[$i] = utf8_encode_all($d); return $ret; } header("Content-type: application/x-json"); echo json_encode(array('api_version' => 0.1, 'results' => utf8_encode_all($results))); ?> \ No newline at end of file