47990

How to receive XML data produced by a website(webservice) in PHP?

Question:

Input is a URL like this <a href="http://ws.geonames.org/children?geonameId=6255148" rel="nofollow">http://ws.geonames.org/children?geonameId=6255148</a> and I would like to receive the XML file in a SimpleXMLElement for example?

Answer1:

Try this as your base point:

<?php $xml = simplexml_load_file("http://ws.geonames.org/children?geonameId=6255148"); //print_r($xml); foreach($xml->geoname as $geo) { echo $geo->toponymName . "<br />"; } ?>

Recommend

  • Illegal mix of collations mysql error?
  • Putting into table from a complicated array using php
  • Get an xml object by attribute
  • Parse RDF XML file to get all rdf:about values
  • Searching an XML file using PHP [closed]
  • PHP Handling Namespace with SimpleXML
  • Angular2 emit event up to the DOM tree
  • Firebase, only get new children
  • read values from form post in jquery or javascript
  • apply a javascript function to draggable copy
  • Consuming a WCF service in a Java Client using wsHttpBinding
  • Exception gevent.hub.LoopExit: LoopExit('This operation would block forever',)
  • In matplotlib, how do you change the fontsize of a single figure?
  • Spring: No transaction manager has been configured
  • accepts_nested_attributes_for practical form use for in Rails 3
  • How to disable all widgets inside Panel or inside Composite?
  • Object and struct member access and address offset calculation
  • How to render a blob on a canvas element?
  • Play WS (2.2.1): post/put large request
  • How to use an array of arrays with array_map(…) in PHP?
  • FFmpeg Conversion Error
  • Java Scanner input dilemma. Automatically inputs without allowing user to type
  • Deserializing XML into class C#
  • what is the difference between the asp.net mvc application and asp.net web application
  • Circular dependency while pushing http interceptor
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • Is there a mandatory requirement to switch app.yaml?
  • bootstrap to use multiple ng-app
  • Matrix multiplication with MKL
  • How to get icons for entities from eclipse?
  • AngularJs get employee from factory
  • Load html files in TinyMce
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • How to set the response of a form post action to a iframe source?
  • coudnt use logback because of log4j
  • Change div Background jquery
  • Turn off referential integrity in Derby? is it possible?
  • JaxB to read class hierarchy
  • Binding checkboxes to object values in AngularJs
  • How to Embed XSL into XML