gptimajo Posted November 21, 2011 Share Posted November 21, 2011 Hi Guys! I'm new here at PHPFreaks, I have this problem using simplexml_load_file function. I am retrieving an XML from another sub-domain of my project, it's working fine on my local server (win xp, php 5.2.14) but when I try to execute it on our testing server (linux, php 5.2.14) it returns an error something like this.. Warning: simplexml_load_file() [function.simplexml-load-file]: failed to open stream: Connection timed out in [absolute path of the script] on line 3 i have tried cURL and file_get_contents, still get no luck. please note that the XML is validated via w3c.org and works really fine on my local server.. Thanks in advanced! Quote Link to comment https://forums.phpfreaks.com/topic/251544-simplexml_load_file-script-url-failed-to-open-stream/ Share on other sites More sharing options...
btellez Posted November 21, 2011 Share Posted November 21, 2011 did you try simplexml_load_string like below when you used file_get_contents... $path = "http://sub.domain.tld/simple.xml"; //sub your actual path $data = file_get_contents($path); # print_r($data); // See what was loaded... $xml = simplexml_load_string($data); Quote Link to comment https://forums.phpfreaks.com/topic/251544-simplexml_load_file-script-url-failed-to-open-stream/#findComment-1290049 Share on other sites More sharing options...
gptimajo Posted November 21, 2011 Author Share Posted November 21, 2011 did you try simplexml_load_string like below when you used file_get_contents... $path = "http://sub.domain.tld/simple.xml"; //sub your actual path $data = file_get_contents($path); # print_r($data); // See what was loaded... $xml = simplexml_load_string($data); i haven't tried simplexml_load_string but what i can tell you is file_get_contents also fails.. Quote Link to comment https://forums.phpfreaks.com/topic/251544-simplexml_load_file-script-url-failed-to-open-stream/#findComment-1290100 Share on other sites More sharing options...
requinix Posted November 21, 2011 Share Posted November 21, 2011 Can you go to the XML file directly? Like right in your browser? Quote Link to comment https://forums.phpfreaks.com/topic/251544-simplexml_load_file-script-url-failed-to-open-stream/#findComment-1290130 Share on other sites More sharing options...
gptimajo Posted November 21, 2011 Author Share Posted November 21, 2011 Can you go to the XML file directly? Like right in your browser? yes i can, in fact it can be validated in w3c.org via URL.. Quote Link to comment https://forums.phpfreaks.com/topic/251544-simplexml_load_file-script-url-failed-to-open-stream/#findComment-1290132 Share on other sites More sharing options...
freelance84 Posted November 21, 2011 Share Posted November 21, 2011 file_get_contents works on other files from your server? Quote Link to comment https://forums.phpfreaks.com/topic/251544-simplexml_load_file-script-url-failed-to-open-stream/#findComment-1290149 Share on other sites More sharing options...
gptimajo Posted November 22, 2011 Author Share Posted November 22, 2011 file_get_contents works on other files from your server? yes it works.. Quote Link to comment https://forums.phpfreaks.com/topic/251544-simplexml_load_file-script-url-failed-to-open-stream/#findComment-1290314 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.