Fix My MQTT to CSV PHP Script

Job ID: 39018884

Budget: $10 – $30 USD

I have a PHP script that translates MQTT data into a CSV file. This script worked perfectly when it was sourcing data from a single MQTT topic. However, I've since moved my GPS data to a separate topic and now the script is parsing data into incorrect columns. I need a skilled developer to correct this code so that the data is parsed correctly again.

Key Details:
- The GPS data and sensor data needs to be put into the right columns, but the specific columns are yet to be determined. This will need to be figured out based on the structure of the data.
- The script currently handles multi-level MQTT topics, but the sorting and parsing needs to be adjusted to accommodate the separate GPS topic.
- The task should not take long for someone with the right skills and experience.

Ideal Skills and Experience:
- Proficient in PHP
- Experienced with MQTT protocol
- Capable of parsing and organizing data accurately
- Quick turnaround time

Below is an example of the mqtt messages.

16:13:58.708 -> DEBUG: MQTT => connected
16:13:58.708 -> DEBUG: publish => Request intervals => log/upload
16:13:58.708 -> DEBUG: 'Request intervals' published successfully
16:14:03.728 -> DEBUG: starting GPS data upload...
16:14:03.777 -> DEBUG: Publishing GPS data => 55.941566,8.781980,-33.90,0.93,6
16:14:03.777 -> DEBUG: GPS data uploaded successfully
16:14:03.777 -> DEBUG: starting log upload...
16:14:03.810 -> DEBUG: publish => 2025-01-22,16:10:25,63,"DO",81.01,%,7.99,mg/L,15.90,C,"TU",18.473,NTU,16.08,C
16:14:03.810 -> DEBUG: uploaded => 2025-01-22,16:10:25,63,"DO",81.01,%,7.99,mg/L,15.90,C,"TU",18.473,NTU,16.08,C
16:14:03.843 -> DEBUG: publish => 2025-01-22,16:11:25,63,"DO",81.01,%,7.99,mg/L,15.93,C,"TU",18.475,NTU,16.08,C
16:14:03.843 -> DEBUG: uploaded => 2025-01-22,16:11:25,63,"DO",81.01,%,7.99,mg/L,15.93,C,"TU",18.475,NTU,16.08,C
16:14:03.843 -> DEBUG: publish => 2025-01-22,16:12:25,63,"DO",81.07,%,7.99,mg/L,15.94,C,"TU",18.473,NTU,16.09,C
16:14:03.883 -> DEBUG: uploaded => 2025-01-22,16:12:25,63,"DO",81.07,%,7.99,mg/L,15.94,C,"TU",18.473,NTU,16.09,C
16:14:03.883 -> DEBUG: logs => removed after upload
16:14:03.928 -> DEBUG: MQTT => disconnected after uploads

attached is a csv file generated from the code.
Point is each unit must be 1 row and each row must have gps data....
Related categories: PHP JavaScript MQTT