I played football and when I hit the ball I got pain in the upper thigh almost at the hip, any suggestions?

If that is the only. Time that the pain presents then it sounds like it may be muscular in origin which may require some attention to those hip flexors & adductors in terms is stretching & strengthening. If you are not sure of what to do or if this does not help, see an orthopedist or physiatrist for an evaluation and treatment plan.