Doctor shopping is illegal? Criminy, I can think of a few people that have done this; never really cared about it one way or the other.
It can be depending on the schedule of the drug. My guess is that these were either schedule 2 or 3 drugs, meaning you're limited to a certain number of refills per 6 months.