Invasive bile determination is very useful in the diagnosis of many gastric pathologies. At the moment, this measurement is performed with Bilitec 2000, an optical fiber sensor, that is based on absorption by bilirubin. Nevertheless, erroneous evaluations are possible, due to the different configurations which the bilirubin molecule can adopt. The optical behavior of human samples of pure bile and bile+gastric juice has been examined using an optical fiber spectrophotometer and two suitably modified Bilitec 2000 units. A protocol has been established for the treatment of biological fluids, in order to make it possible to study the behavior of their optical properties as a function of pH and concentration without causing any alteration in the samples. The analysis of pH dependence evidenced the presence of different calibration curves at different pH values: the selfaggregation of the bilirubin molecules observed in pure bile samples was almost totally absent in the gastric samples. Measurements carried out on Bilitec 2000 showed that the most appropriate wavelength for bilirubin detection in the stomach should be 470 nm.