Page 1 of 1

Problems with file_get_contents()

Posted: Wed Mar 21, 2007 4:53 pm
by Pesho
Hello,

for the last few hours I've been trying to solve the following problem, I couldn't figure it out.
I'm trying to obtain the XML content of a data provider...

However, the following code only returns the text between the xml tags:
echo file_get_contents("http://ir.ub.rug.nl/oai/?verb=ListRecor ... fix=oai_dc");


I need the whole xml structure though.

I'd appreciate if you could give me a hint about this.


Regards,
Pesho

Posted: Wed Mar 21, 2007 5:12 pm
by Zoxive
The hole xml structure is there, you just need to view the source, because the browser is outputting it like text, so its ignoring the what it thinks are "html" brackets.

Code: Select all

<?php

// Just telling the browser its xml, to show you that its giving you everything
header("Content-type: text/xml");

echo file_get_contents("http://ir.ub.rug.nl/oai/?verb=ListRecords&metadataPrefix=oai_dc"); 

?>
-Zoxive

Posted: Wed Mar 21, 2007 5:12 pm
by Mordred
You are getting the whole XML, it's just that your browser is not showing the tags. View source and you'll see it's all there.
Ясно?

Posted: Wed Mar 21, 2007 6:03 pm
by Pesho
Thanks guys !!! и Благодаря :)

Posted: Wed Mar 21, 2007 6:21 pm
by harrisonad
htmlentities() - Convert all applicable characters to HTML entities