The invention provides a 
corrosion inhibitor for treating oilfield 
produced water, which comprises an imidazoline group and a phosphonic 
acid group. 350 to 450 parts of 
diethylene triamine, 650 to 750 parts of 
oleic acid, 15 to 25 parts of heteropolyacid serving as a catalyst and 950 to 1100 parts of 
dimethyl benzene serving as a water-carrying agent are added to a reactor by weight, stirred and heated to a temperature of 150 DEG C, the 
reaction temperature is kept at 140 to 220 DEG C, and after a 
reaction product flows back for 5 to 8 hours, 
oleic acid imidazoline is obtained. Under a normaltemperature condition, 350 to 450 parts of 
oleic acid imidazoline, 20 to 30 parts of 
hydrochloric acid serving as a catalyst and 55 to 65 parts of 
formaldehyde are added to the reactor and stirred for 0.5 to 4 hours, 65 to 75 parts of 
isopropyl alcohol solutions of 
phosphorous acid is added to the reactor and stirred for 1 to 2 hours, then pH value of a 
reaction product is regulated to 6 by usinghydrochloric acid, and a finished product of the 
corrosion inhibitor with for treating the oilfield 
produced water, which has a concentration of 90 percent, is obtained. The 
corrosion inhibitor has ahigh corrosion inhibition rate, is easy to be dissolved in water and is modified by using cheap raw materials; and the cost for preparing the 
corrosion inhibitor is low.