Little help please!!
$parameters['audio_clip[uploaded_data]'] = "@http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']) . "upload/" . $_FILES['test_file']['name'] .";type=". $_FILES['test_file']['type'];
$parameters['audio_clip[uuid]'] = gen_uuid();
$parameters['audio_clip[title]'] = "Remote Upload Test";
$parameters['audio_clip[recorded_at]'] = "";
$parameters['audio_clip[tag_list]'] = "tag, podcast, test";
$parameters['audio_clip[category_id]'] = 60;
$options = array();
$options['RequestContentType'] = "multipart/form-data";
$options['RequestBody'] = '';
$options['return_auth'] = 1;
$auth = $client->CallAPI($url, $method, $parameters, $options,
$response);
$headers = array(
"POST ".$auth['RequestURI']." HTTP/1.0",
"Authorization: " . $auth['Headers']['Authorization'],
"Accept: */*",
"Host: " . $auth['Headers']['Host'],
"Content-Type: multipart/form-data",
"Content-Length" . $auth['Headers']['Content-Length'],
"User-Agent: " . $auth['Headers']['User-Agent']
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$exec = curl_exec($ch);
curl_close($ch);
echo "<pre>Output: ";
print_r($exec);
echo "</pre>";
Trying to upload a file via the API to audioboo.fm . The relevant documentation is here: https://github.com/Audioboo/api/blob/master/sections/audio_clips.md
The reply I get from the server is raw attachment invalid/blank. Not sure what I'm doing wrong? I can manage simple PUT/GET requests and I know I'm authenticated properly, however I'm having trouble sending a file. (It is an MP3).
Cheers