Skip to content

Instantly share code, notes, and snippets.

@luiscelismx
Created February 28, 2014 22:17
Show Gist options
  • Select an option

  • Save luiscelismx/9281160 to your computer and use it in GitHub Desktop.

Select an option

Save luiscelismx/9281160 to your computer and use it in GitHub Desktop.
<?php
/*
-- =============================================
-- Author: Luis Antonio Celis Molina
-- Create date: 15/03/2013
-- Description: Ejemplo de como consumir un Webservices XML
-- =============================================
*/
//Definir la ruta del Webservice
$completeurl = "http://ws.audioscrobbler.com/2.0/?method=user.getInfo&user=luiscelismx&api_key=idelapidelastfm";
//Generar XML, enviando como parametro la ruta del Webservice
$xml = simplexml_load_file($completeurl);
//Imprimir en pantalla la información obtenida, en este caso el userId y el userName
echo "User id: ".$xml->user->id. "\n Nombre: ". $xml->user->name;
//Imprimir el XML
echo $xml->asXML();
echo "<br/>";
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment