Hello people, could someone help me. I have two bits of PHP code that I need to get to work with each other. Basically I need to import two pieces of data submitted by a CMS and copy them into a query to get album covers from amazon web services. Once I know how to do this for one piece of data I should be able to figure it out for the other. Thanks if you can help :-)
So here is the code that displays the artist name:
<div class="field field-type-text field-field-artist-name">
<h3 class="field-label">Artist Name</h3>
<div class="field-items">
<?php foreach ((array)$field_artist_name as $item) { ?>
<div class="field-item"><?php print $item['view'] ?></div>
<?php } ?>
</div>
</div>
And here is the section of the AWS code I need to automatically fill:
<?
$accesskey = ('key)_id_here');
$artist = urlencode('artist name');
$album = urlencode('album name');
$images = file_get_contents('http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId='.$accesskey.'&Operation=ItemSearch&SearchIndex=Music&ResponseGroup=Images&Artist='.$artist.'&Title='.$album.'');
include('xml.php');
$data = XML_unserialize($images);
$error = $data[ItemSearchResponse][Items][Request][Errors][Error][Message];
$smallimage = $data[ItemSearchResponse][Items][Item][0][SmallImage][URL];
$mediumimage = $data[ItemSearchResponse][Items][Item][0][MediumImage][URL];
$largeimage = $data[ItemSearchResponse][Items][Item][0][LargeImage][URL];
if (!$error) {
print ('
<img src="'.$smallimage.'" />
<img src="'.$mediumimage.'" />
<img src="'.$largeimage.'" />
');
} else {die($error);}
?>
The third line is where I need the code to automatically pick up the artist name. Thanks.