Skip to content

Instantly share code, notes, and snippets.

@lloc
Last active December 22, 2017 09:36
Show Gist options
  • Save lloc/4525307 to your computer and use it in GitHub Desktop.
Save lloc/4525307 to your computer and use it in GitHub Desktop.
<?php
$url = 'http://ws.geonames.org/search?q=london&maxRows=10&username=USERNAME';
$xml = simplexml_load_file( $url );
echo "Ausgabe des SimpleXML-Objects:\n";
print_r( $xml );
$json = file_get_contents( $url . '&type=json' );
$arr = json_decode( $json );
echo "Ausgabe der JSON-Daten als Array:\n";
print_r( $arr );
/**
* https://github.com/semsol/arc2.git
*/
include_once 'arc2/ARC2.php';
$parser = ARC2::getRDFParser();
$parser->parse( $url . '&type=rdf' );
$triples = $parser->getTriples();
echo "Ausgabe der RDF-Daten als Array:\n";
print_r( $triples );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment