This note describes the search for a Higgs boson decaying into diphotons in pp collisions at the LHC at a center-of-mass energy of 7~TeV. Data-driven methods are used to evaluate the reconstruction and selection performance for the signal, and the background is evaluated from a fit to the data. The analysis is performed on a dataset corresponding to 4.8~fb of data recorded in 2011 by the CMS experiment. Limits are set on the cross section of a Standard Model Higgs boson decaying to two photons. The expected exclusion limit at 95\% CL is between 1.5 and 2.0 times the Standard Model cross section in the mass range between 110 and 140~GeV/c, and the observed limit disfavours at 95\% CL a Standard Model Higgs boson decaying into two photons in the mass range 127 to 131~GeV/c.