0

I want to use PHP to load a XML from a URL like "HTTP://127.0.0.1/19/1", how can I do it? I tried several ways but they all failed.. so just ask for help here..thanks

3
  • 1
    What did you try, and why does it fail(error-message)? Commented Jul 12, 2012 at 18:02
  • I tried things on this website, php.net/manual/en/function.simplexml-load-file.php Commented Jul 12, 2012 at 18:09
  • What do you get if you load the URL in a browser? If you don't see the XML (or, as @qxxx suspects, you see a login prompt) then the problem is with the URL you're using, not PHP/simplexml Commented Jul 12, 2012 at 18:16

1 Answer 1

1
<?php
$x=simplexml_load_file("HTTP://127.0.0.1/19/1");
?>
Sign up to request clarification or add additional context in comments.

2 Comments

I get error like this:failed to open stream: HTTP request failed! HTTP/1.1 401 OK
401 means that you need to enter a user/password first... or the request is blocked for some other reason - try this: $x=simplexml_load_file("HTTP://user:[email protected]/19/1"); (but I didn't try this)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.