How did Flamingo get the Mera Mera no mi? The only place we've seen them together is during the war. Long before Ace died, Flamingo disapeared (after talking to Moria).

So, how did he get the Mera Mera no mi? Is it a real one or just an artificial one made with Smile?
Doflamingo was there for the death of Ace, as were all the warlords. The situation with Moria happened afterwards. 

From what we've seen with Smiley and the axolotl fruit, it seems that when a Devil Fruit eater dies, it takes over another fruit, somewhere in the world, and with Smiley that fruit happened to be very nearby. So it is possible that Doflamingo had an apple in his pocket which became the Mera Mera no Mi after Ace's death.

But there are many possibilities, the current owner of the Mera Mera is Sabo, which he gained possession of by defeating Diamanté and the others. He was definitely nowhere near Ace, it is also easily possible that Doflamingo did the same as Sabo did and just took it from whomever found it.