To provide carbon steel a long corrosion protection effect in NaCl solution with various pH, a pH-controlled intelligent inhibitor based on poly-acrylamide (PAM) and oleate imidazoline (OIM) was synthesized. SEM, FT-IR and TGA results indicating the OIM inhibitor was successfully loaded into PAM hydrogel with a very high content (39.64 wt%). The OIM release behavior from hydrogel structure have two stages, quickly release and sustained release. The pH of solution could affect the initial release kinetics of OIM inhibitor and the diffusion path in hydrogel structure. Weight loss measurement of L80 steel in different pH solution with OIM@PAM proved the inhibitor responsive release mechanism and an-ti-corrosion performance. The inhibition efficiency of OIM@PAM can maintain over 80% after long term immersion in harsh corrosive environment (pH 3), which is much higher than the inhibition efficiency of inhibitor in moderate corrosive solution.