reading xml content from a url

i have a url

and  it has xml content

i want to read this xml content usign php

can any one please help me out

Thank you

Srikanth
LVL 13
srikanthmadishettiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RoonaanCommented:
You can just use:

$xml = file_get_contents('http://domain.com/xmlfile.xml');

-r-
0
srikanthmadishettiAuthor Commented:
<?php
$xml = file_get_contents('http://preisvergleich.guenstig.de/xservice/getCategoryList.do?version=2.3');
?>

iam tryign to read like this it throws errors

thatz the url from where i need to read the xml content and i want the seperated content
0
RoonaanCommented:
What kind of errors. The url seems to work for me.

-r-
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

CaveyCoUkCommented:
If you look in the PHP manual it notes -

Tip: You can use a URL as a filename with this function if the fopen wrappers have been enabled.

The feature to enable/disable this is this one -

allow_url_fopen boolean
  This option enables the URL-aware fopen wrappers that enable accessing URL
   object like files. Default wrappers are provided for the access of remote files
  using the ftp or http protocol, some extensions like zlib may register additional
  wrappers.

However, fopen wrappers can be a security risk and can be disabled by security conscious admins, especially on shared hostng.  Check it is not enabled.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
srikanthmadishettiAuthor Commented:
Warning: file_get_contents(): php_network_getaddresses: gethostbyname failed in D:\guenstig\guenstig1\gunxml.php on line 4

Warning: file_get_contents(http://preisvergleich.guenstig.de/xservice/getCategoryList.do?version=2.3): failed to open stream: No such file or directory in D:\guenstig\guenstig1\gunxml.php on line 4

this is the error it gives to me
0
srikanthmadishettiAuthor Commented:
i kept the allow_url_fopen- on in php.ini file but still i get the same error.

0
srikanthmadishettiAuthor Commented:
but i want to know after reading the file using file_get_contents how can i get the seperated content like we have starting tag ending tags <itmes></itmes> so i want all the contents of this xml contents
0
gowniCommented:
Hello ,

Use CURL instaed of fopen to read the URL.

Karunakar
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.