Proton-proton interaction and photo-hadronic interaction in cosmic accelerators are the two main channels for the production of cosmic ultra-high energy photons and neutrinos ( TeV-PeV ) . In this Letter , we use FWW approach to obtain the production of cosmic ultra-high energy photons and neutrinos from the collision between UHE proton with magnetic field which could be considered as the virtual photon in the rest frame of UHE proton . We name this as pB process . The threshold for the occurrence of the pB process is that the combination of the Lorentz factor of proton and the strength of the magnetic field is about \gamma _ { p } B \simeq 5 \times 10 ^ { 18 } Gauss . Beyond this threshold , the rate of energy loss of proton due to the pB process is about three orders higher than that due to the synchrotron radiation of proton in the same magnetic field . The pB process might potentially happen in the atmosphere of white dwarfs , neutron stars or even that of stellar massive black holes .