Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $url = 'http://hebbohotel.com.br/swf/gordon/RELEASE-HEBBO/effectmap.xml';
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); //Transferencia binaria
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Força retornar transferência na variavel
- $xml = gzdecode(curl_exec($ch));
- curl_close($ch);
- $dom = new DOMDocument;
- $dom->loadXML($xml);
- $effects = iterator_to_array($dom->getElementsByTagName('effect'));//Passa para array
- //-3 no segundo parametro pega os 3 ultimos itens
- $effects = array_slice($effects, -3);
- foreach ($effects as $effect) {
- echo $effect->getAttribute('id'), PHP_EOL;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement