$node = array('tag' => $xml->name, 'value' => $xml->isEmptyElement ? '' : xml2assoc($xml)); if ($xml->hasAttributes) { while ($xml->moveToNextAttribute()) { $node['attributes'][$xml->name] = $xml->value; } } $tree[] = $node; break; case XMLReader::TEXT: case XMLReader::CDATA: $tree .= $xml->value; } } return $tree; } $api = new DandyID_Api('o0xa47o98x9ycoko5xkz326qb4gotk3iu1ty'); $result = DandyID_Api::submitHttpPost($api->returnServicesURL('155')); $xml = new XMLReader(); $xml->open($api->returnServicesURL('155')); $assoc = xml2assoc($xml); $xml->close(); echo '<textarea cols=80 rows=20>'; print_r($assoc); echo "</textarea><br />\n\n"; // ################################################ echo "# ################################################<br />\n"; $services = $assoc[0]["value"]; $count = count($services); $count = 20; // debug limit to 10 echo "count => {$count}<br />\n";
<?php require_once 'lib/DandyID/Api.php'; require_once 'lib/DandyID/Service.php'; DandyID_Api::$api = new DandyID_Api('o0xa47o98x9ycoko5xkz326qb4gotk3iu1ty'); $api->createRequest(); $RETURN_SERVICES_PREFIX = 'return_services' + $api; $RETURN_PROFILE_PREFIX = 'http://www.dandyid.org/api/return_profile' + $api; $REVERSE_LOOKUP_PREFIX = 'http://www.dandyid.org/api/reverse_lookup' + $api; $SERVICE_DETAIL_PREFIX = 'http://www.dandyid.org/api/service_details' + $api; $RETURN_CONTACTS_PREFIX = 'http://www.dandyid.org/api/return_contacts' + $api; $servicesXML = simplexml_load_string('http://www.dandyid.org/api/return_services/o0xa47o98x9ycoko5xkz326qb4gotk3iu1ty/155/public', 'ServicesXMLElement'); ?> <html> <body> <?php echo $servicesXML->asXML(); ?> </body> </html>