[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1293
  • Last Modified:

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
0
srikanthmadishetti
Asked:
srikanthmadishetti
2 Solutions
 
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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
 
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now