Turkey maintains a website for visitors to their country that details which countries need Visas, or passports, and which countries may purchase their visitor Visa upon arrival. Look up your country's details on this government site.

If you are allowed to purchase a visitor Visa upon landing in Istanbul, be sure that you purchase your Visa BEFORE you queue for the immigration officer. You MUST have the Visa stamp in your passport BEFORE you approach the immigration officer.