Some error handling, the script exists when it cannot find the required data in the database.
The former search covered all values of the data search through, like all records of a table, and it did a substring search. So it was never sure if it found the right data, and if the results were unique. It was using the first reply of a query. To clean this, I added a field to search to query_id, and made it search exactly for the string in that field. If it finds no result or more than one, it considers that both invalid answers.
I added some error handling.
The URL wasn't safe for special characters like spaces. Since they are allowed in Satellite, we should handle them correctly.
This change addresses the following issues: