Earlier this week, a former governor of New Jersey went undercover to expose the struggle homeless people go through if they are mentally ill.

Democratic state Sen. Richard Codey, who briefly took over as governor after Jim McGreevey (D) resigned in 2004, began calling homeless shelters last November only to find out that they were hesitant to take "crazy people," required ID or that the person be on welfare.

"To find some place to take you if you were homeless was impossible, essentially, unless you were on some government entitlement program," he explained to NBC New York.

After spending an hour with a makeup artist to make him unrecognizable, Codey took on the fictional identity of Jimmy Peters, a mentally ill man who had been recently released from a local hospital's psychiatric ward.

Case worker Ross Croesmann was able to get the former governor into Goodwill Rescue Mission in downtown Newark for one night. Other shelters refused to take him at all.

"Sometimes you get in, sometimes you don't," Essex County Mental Health Association director Bob Davison said.

In the end, Codey described his stay as "better than expected," but still had to sleep on the floor with about 20 other men.

"For me it was tough, I sleep on my side so by 3 a.m. my hip was hurting," he said, adding that someone at the shelter also told him he would have to sign up for welfare if he wanted to stay another night.

"We don’t accept any funding from welfare or anybody else," Goodwill Rescue Mission's Carmella Hutson told The Star-Ledger. "I can’t imagine who would have told him that. ... We help the folks with no ID, we help the folks with mental illness."

The next morning, Codey returned to his day job as a state senator, a luxury that most homeless do not have.

Watch this video from NBC New York, broadcast March 7, 2012.

Visit msnbc.com for breaking news, world news, and news about the economy