Hi,
i´m struggling atm with the simple action of sending the json data from the enfmp tagger to the server.
"_" => _
$file =file_get_contents('./test.json');
$jsondecode = json_decode($file,true );
foreach($jsondecode as $puffer) {
$result = $puffer['code'];
}
$post = array(
"api_key"=>"=MYAPIKEY",
"version"=>"=3.15",
"code"=>"=$result",
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, "http://developer.echonest.com/api/v4/song/identify");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
$json_response = curl_exec($ch);
$response = json_decode($json_response, true);
The Response is
["response"]=>
array(1) {
["status"]=>
array(3) {
["version"]=>
string(3) "4.2"
["code"]=>
int(1)
["message"]=>
string(22) "1|Invalid key: Unknown"
}
}
}
Can someone look over the code and give me some hints or examples?
greetings :)