simplexml_load_string
simplexml_load_file
$hh = curl_init(); $url = "домен: порт"; curl_setopt( $hh, CURLOPT_URL, $url ); curl_setopt( $hh, CURLOPT_RETURNTRANSFER, 1 ); $result = curl_exec( $hh ); curl_close( $hh ); $dom = new domDocument; $dom->loadHTML( $result ); $dom->preserveWhiteSpace = false; $tables = $dom->getElementsByTagName( 'table' ); $rows = $tables->item( 2 )->getElementsByTagName( 'tr' ); foreach ($rows as $row) { $cols = $row->getElementsByTagName( 'td' ); // echo $cols->item(0)->nodeValue . ' '; // echo $cols->item(1)->nodeValue . ' '; if (strpos( $cols->item(0)->nodeValue, "Сейчас играет" ) !== false) { echo $cols->item(1)->nodeValue; break; } }
<?php $data=file_get_contents("http://api.radionomy.com/currentsong.cfm?radiouid=f1db3dd5-c4e3-41df-a2d1-ece1a93127d6&apikey=1ac65a51-d6e4-4975-b22c-703b926be25d&callmeback=yes&type=xml&cover=yes&previous=yes"); preg_match("|<artists>(.+?)</artists>|is", $data, $out); echo 'Исполнитель - '.$out[1].'<br />'; preg_match("|<title>(.+?)</title>|is", $data, $out); echo 'Композиция - '.$out[1].'<br />'; ?>