curl_setopt($ch, CURLOPT_MAXREDIRS, 10); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: text/turtle, text/n3; q=0.9, application/turtle; q=0.8, application/n-triples; q=0.7, application/rdf+xml; q=0.6, application/json; q=0.4, */*; q=0.1")); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); $_aux = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); $_aux2 = explode(";", $_aux); $content_type = array_shift($_aux2); curl_close($ch); $parser = NULL; $parsers = array(); $parsers[0]['formats'] = array('text/n3', 'application/x-turtle', 'application/turtle', 'text/turtle'); $parsers[0]['parser'] = ARC2::getTurtleParser(); $parsers[1]['formats'] = array('application/rdf+xml'); $parsers[1]['parser'] = ARC2::getRDFXMLParser(); $parsers[2]['formats'] = array('application/json', 'application/x-javascript', 'text/javascript', 'text/x-javascript', 'text/x-json'); $parsers[2]['parser'] = ARC2::getJSONParser(); foreach ($parsers as $v) { if (in_array($content_type, $v['formats'])) { $parser = $v['parser']; } } //If nothing fits, pray to your favorite god that this can be detected and parsed correctly by ARC2. $parser = ARC2::getRDFParser(); //end of workaround $parser->parse($u, $data); //Since IDK which namespace the documents contains, lets use the uri requested $triples = $parser->getTriples(); $first = true; $c = 0; $nodes = array(); $literals = array();