<?php $url = 'http://server.com/song.mp3'; $data = json_decode(file_get_contents('http://api.rest7.com/v1/sound_waveform.php?url=' . $url)); if (@$data->success !== 1) { die('Failed'); } $image = file_get_contents($data->file); file_put_contents('waveform.png', $image);