I'm new to this so bear with my noobish question.
Basically I want a user to enter a search phrase into a web-form and for the query to be passed to the lastFM API and return top artists using that phrase based on their "gettopartists" API node. Here's the code I have...
function last($q) {
$target_url='http://ws.audioscrobbler.com/2.0/format=json&method=tag.gettopartists&api_key=....&tag=' . $q . '';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$target_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
$return = curl_exec($ch);
}
Obviously within that I get a valid return by printing "echo $return;" but I've no idea how to parse it correctly. No matter how many foreach arguments I put in I cannot avoid an error or no output at all...
Thanks folks...