PHP Extract Ole Object to WAV

  ms-access, ole, php

I have a MDB which contains an Ole Object in a Long Binary field. I’m able to get PHP to open the MDB but I can’t for the life of me figure out how to recreate the WAV file from the Ole Object.

$conn = new COM("ADODB.Connection") or die("Oops!");
$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)};DBQ=temp/pauld/UnityDBData_Backup_192.168.102.33_20210504_14_32_09.mdb","","password");
$data = $conn->Execute("Select CallHandlers.TextName, CUC_GreetingStreams.GreetingType, CUC_GreetingStreams.Greeting from CallHandlers inner join CUC_GreetingStreams on CallHandlers.ObjectID = CUC_GreetingStreams.CallHandlerObjectID");


$num_columns = $data->Fields->Count();
while (!$data->EOF) {
   
    $fileName = "temp/pauld/" . $data->Fields(0)->value . $data->Fields(1)->value . ".wav";
    $fH = fopen($fileName, 'w') or die("cant open file");
    fwrite($fH,$data->Fields(2)->value);
    fclose($fH);
    
    $data->MoveNext();
}

$data->Close();
$conn->Close();

$data = null;
$conn = null;

Any help would be appreciated, need to extract a few thousand WAV files from a few MDB files stored a OLE Objects

Source: Ask PHP

LEAVE A COMMENT