Utherr12 Posted March 31, 2011 Share Posted March 31, 2011 Ok...I have googled and got numerous methods on how to get the contents of a page...none worked. One stated that working with file_get_contents or fopen works. In my code I get "no such file".I tried XMLReader, i got XMLReader::open(): Unable to open source data.How DO I get that remote document as a string? Link to comment Share on other sites More sharing options...
justsomeguy Posted March 31, 2011 Share Posted March 31, 2011 It sounds like you're using the wrong filename. Link to comment Share on other sites More sharing options...
Utherr12 Posted March 31, 2011 Author Share Posted March 31, 2011 I am sure I'm not lol... I can access it anytime in my browser. (it's a php script that spits a xml-formatted string)LE: file_get_contents(0): failed to open stream: No such file or directory Link to comment Share on other sites More sharing options...
jeffman Posted March 31, 2011 Share Posted March 31, 2011 Try DOMDocument. I have a lot of success with it.Post your code. There might be something a little wrong. Link to comment Share on other sites More sharing options...
justsomeguy Posted March 31, 2011 Share Posted March 31, 2011 Well, if the option on your server is enabled to open remote files using fopen, then all you need to do is use file_get_contents with the URL. e.g.:$response = file_get_contents('http://www.google.com'); file_get_contents(0): failed to open stream: No such file or directoryThat claims you are trying to open a file called "0". Link to comment Share on other sites More sharing options...
Utherr12 Posted March 31, 2011 Author Share Posted March 31, 2011 $plugin = isset($_REQUEST['_plugin']) ? trim(strip_tags($_REQUEST['_plugin'])) : 'z';$remote = file_get_contents(urlencode("http://www.dokuwiki.org/lib/plugins/pluginrepo/repository.php?plugins="+$plugin));$xml = new XMLReader;$xml->XML($remote);$xml->close(); Warning: file_get_contents(0): failed to open stream Link to comment Share on other sites More sharing options...
justsomeguy Posted March 31, 2011 Share Posted March 31, 2011 The plus operator is for addition, that's why it's returning 0. You shouldn't be URL-encoding the entire URL either. Link to comment Share on other sites More sharing options...
Utherr12 Posted March 31, 2011 Author Share Posted March 31, 2011 omg... Damn javascript, sorry. It happens a lot when I switch from javascript to php (but not the other way around).Nevermind ... i got the last error because i didn't include http:// Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.