This is what I have done to display the images steps and infos
<?php
$completeurl="http://api.wolframalpha.com/v2/query?format=html,image,plaintext&appid=XXX" . "&input=" . $_GET['q'];
$xml = simplexml_load_file($completeurl);//simplexml_load_file($completeurl,'SimpleXMLElement', LIBXML_NOCDATA);
function xml_attribute($object, $attribute)
{
if(isset($object[$attribute]))
return (string) $object[$attribute];
}
$numpods = xml_attribute($xml, 'numpods');
for ($i = 0; $i < $numpods; $i++) {
echo "<h1>" . xml_attribute($xml->pod[$i], 'title')."</h1><br />";//echo $xml->pod[$i]->asXML();
echo xml_attribute($xml->pod[$i]->img,'src');
$numsubpods = xml_attribute($xml->pod[$i],'numsubpods');
for ($j = 0; $j < $numsubpods; $j++) {
echo "<img src=".xml_attribute($xml->pod[$i]->subpod[$j]->img,'src')."/><br />";
}
$states = xml_attribute($xml->pod[$i]->states,'count');
for ($numstate = 0; $numstate < $states; $numstate++) {
echo "<br /><button type=\"button\">". xml_attribute($xml->pod[$i]->states->state[$numstate],'name') . "</button>: " . xml_attribute($xml->pod[$i]->states->state[$numstate],'input') . "<br />";
}
$infos = xml_attribute($xml->pod[$i]->infos,'count');
for ($numinfo = 0; $numinfo < $infos; $numinfo++) {
echo "<br /><img src=" . xml_attribute($xml->pod[$i]->infos->info[$numinfo]->img,'src') . "/>|<a href=" . xml_attribute($xml->pod[$i]->infos->info[$numinfo]->link,'url') . ">" . xml_attribute($xml->pod[$i]->infos->info[$numinfo]->link,'text') . "</a><br />";
}
echo "<hr />";
}
?>
All I need is the correct format/url to dsiplay step-by-step calculation.
Also I tried to display the <![CDATA[ nodes in the xml output however, only the first CDDATA is displayed and other are ignored. Also the step-by-step url looks like a relative url like pod.jsp?id........ What is its absolute url?
Sorry for troubling you guys.
regards