As of May 1, 2014, Immigrants Can Access CBP Arrival Departure Records Online

As of May 1, 2014, anyone who has entered or exited the U.S. on a nonimmigrant visa during the past 5 years can access their arrival and departure records directly on the U.S. Customs and Border Patrol (CBP) website at:
CBP is now allowing electronic access to records through its Nonimmigrant Information System (NIIS), rather than requiring a records search through the Freedom of Information Act (FOIA). This is good news because a FOIA request can take up to a year in some cases.
The NIIS will only include your arrival and departure records if you have entered or exited the U.S. on a nonimmigrant visa, such as the B-1/B-2 visitor's visa, the H-1B and TN visas for temporary workers, or the F-1 student visa, during the past 5 years. 
The new system can help if you entered the U.S. lawfully before CBP started issuing I-94 Arrival Departure cards electronically only, and you no longer have your paper I-94 card. In that case, you can go online and search the database to get proof that you did in fact enter lawfully. Such proof is necessary when applying for certain immigration benefits, for example to adjust your status to lawful permanent resident (to get your green card) based on marriage to a U.S. citizen.