Skip to content

Convert MP3 to WAV in PHP

rest7 edited this page Jun 14, 2017 · 1 revision

Converting MP3 audio files to WAV in PHP using free API:

<?php
$url = 'http://server.com/sound.mp3';
$data = json_decode(file_get_contents('http://api.rest7.com/v1/sound_convert.php?url=' . $url . '&format=wav'));

if (@$data->success !== 1)
{
    die('Failed');
}
$wave = file_get_contents($data->file);
file_put_contents('sound.wav', $wave);
Clone this wiki locally