Parsing Amazon Web Services

$xml = aws_signed_request("com",
array(
	"Operation" => "ItemSearch",
	"Type" => "Light",
	"SearchIndex" => "DVD",
	"Title" => $title,
	"ResponseGroup" => "Medium"
),
$public_key,$private_key);

foreach($xml->Items->Item as $xml_item) {
	$xml_sm_img = $xml_item->SmallImage->URL;
	$xml_lg_img = $xml_item->largeImage->URL;
}

if I echo $xml_sm_img; I get the full URL: http://ecx.images-amazon.com/images/I/51r4tDydiaL._SL75_.jpg. However, if I var dump it I get

object(SimpleXMLElement)#7 (1) { [0]=> string(60) "http://ecx.images-amazon.com/images/I/51r4tDydiaL._SL75_.jpg" }

How do I get this into a string so I can put it in a SESSION?

You can cast the SimpleXMLElement object to a string like so:

$xml_sm_img = (string) $xml_item->SmallImage->URL;

See: Converting to string in the manual.

Excellent! Thank you so much! :slight_smile: