Gaping, poping(clearing mucus out of the throat), and tilting the head back(again trying to get mucus out of the throat) are all signs of repitory infection. With any type of infection one of the most important things you can do yourself is to raise the ambient temperatures, 24/7. Chameleons are cold blooded and cannot raise their body temperatures like us to boost their immune system(a fever) to help fight infection, so you need to give him a fever. Make it so his ambient temps stay at 85-90 degrees 24 hours a day. This REALLY helps chameleons with infections, and if you get him to a vet and he/she perscribes medication it will help the medication work faster.
Oh and by the way if your vet perscribes a medication called baytril make sure your cham gets TONS of water durring the treatment. Baytril is really hard on the kidneys and can cause a bunch of problems by itself. Actually with any antibiotic you want to make sure your cham is extremely hydrated. You can aslo ask you vet if he/she knows of any other meds that he/she thinks might work or get a sensitivity culture done to see what other meds will work. I recently used a medication called trimethoprim sulfamethoxazole and it worked great for me with no side effects. Here's my thread on it,
https://www.chameleonforums.com/respitory-infection-cured-without-baytril-82547/
Good luck and hope everything goes well for the little guy,
-Alex