
The file containing your iPhone's text messages resp. address book entries is stored on your computer within iTunes' backup folder:C:\Users\[your username]\Application Data\Apple Computer\MobileSync\Backup\[some id]\
and search for a file named 3d0d7e5fb2ce288813306e4d4636395e047a3d28.mddata. Note: the file's extension could also be .mdbackup instead of .mddata or even be empty.C:\Documents and Settings\[your username]\Application Data\Apple Computer\MobileSync\Backup\[some id]\ and on Mac OS X, the file may be located in your home folder: ~/Library/Application Support/MobileSync/backup/[some id]/ but better just try searching it with spotlight.~/Library/Application Support/MobileSync and proceed from there.
Alternatively, hold down the Option key ⌥ while accessing the "Go" menu of the Finder and choose the Library menu item as shown here.
.mdbackup.
C:\Documents and Settings\[your windows login name]\Application Data\Apple Computer\MobileSync\Backup\[some id]\ <data> tag which contains the backup content encoded in a sqlite v3 database format.
Using php's built-in sqlite functionality it's a simple task to extract the actual data out of that iPhone iMessage backup file then.C:\Documents and Settings\[...]21ae31eddf\>grep -l sms.db * in the iTunes backup folder.