Created
February 28, 2014 22:17
-
-
Save luiscelismx/9281160 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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