// Get all unread messages from your Google Voice Voicemail. $voice_mails = $gv->getUnreadVoicemail(); $msgIDs = array(); foreach ($voice_mails as $v) { echo 'Message from: ' . $v->phoneNumber . ' on ' . $v->displayStartDateTime . ': ' . $v->messageText . "<br><br>\n"; if (!in_array($v->id, $msgIDs)) { // Mark the message as read in your Google Voice Voicemail. $gv->markMessageRead($v->id); $msgIDs[] = $v->id; } } // Download all unread Google Voice voicemails as indididual MP3 files. $voice_mails = $gv->getUnreadVoicemail(); $msgIDs = array(); foreach ($voice_mails as $v) { // Uncomment next line if you want message texts displayed as in previous example. // echo 'Message from: '.$v->phoneNumber.' on '.$v->displayStartDateTime.': '.$v->messageText."<br><br>\n"; // Download individual voicemail. $mp3 = $gv->getVoicemailMP3($v->id); // construct mp3 filename using message id as filename. $mp3file = $v->id . ".mp3"; // write mp3 file to disk. $fh = fopen($mp3file, 'w') or die("can't open file"); fwrite($fh, $mp3); fclose($fh); if (!in_array($v->id, $msgIDs)) { // Mark the message as read in your Google Voice Voicemail. $gv->markMessageRead($v->id); $msgIDs[] = $v->id; } }