<?

/************************************************************************
*
*                  OMS Web Service Functions 1.4
*                  -----------------------------
*
*     Copyright:   (C) 2007 moving primates GmbH
*      Function:   GetArtistRadio
*   Description:   Gets the information if an artist has songs online
*                  which can be played the lofi or hifi version.
*   Change Date:   12/Jun/2007
*
*************************************************************************
*
*   REQUIRED ELEMENTS:
*
*   The following required elements must be send with the request:
*
*   - ArtistID
*
*   FIELD ELEMENTS: None
*
*************************************************************************
*   More info about elements and the functions can be found inside
*   the documentation.
************************************************************************/

$ArtistID = "42028"; // Example ID from an artist
include("inc/config.php"); // Example path, point it to your config.php


$dom = create_document();
$root = create_root_element($dom, "OMS");
create_element_attribute($root, "xmlns", $oms_cfg['artist_data_xmlns'] . "/GetArtistRadio");


// Here we are defining the REQUIRED elements

$el_artist_id = create_element($dom, "ArtistID");
set_element_value($dom, $el_artist_id, $ArtistID);


// Preparing the XML which is going to be send

add_child_element($root, $el_artist_id);

$xml_str = dump_to_string($dom);

$par = array("String_1" => $oms_cfg['ws_login'],
            
"String_2" => $oms_cfg['ws_password'],
            
"String_3" => $xml_str );


// Executing the Web Service function "GetArtistRadio"

$GetArtistRadio = ProcessWSCall($oms_cfg['artist_data_ws_url'], "GetArtistRadio", $par, $oms_cfg['artist_data_xmlns']);


/************************************************************************
*
*   From here on we assign the content of the array to variables and
*   create some example output. This was done so you can see something
*   when opening the PHP files with your browser.
*
*   If you are looking for this code without any comments or output,
*   then check out the folder 'minimal_code'.
*
************************************************************************/

?>

<style type="text/css">
<!--
.font {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
}
-->
</style>

<span class="font"> <strong>We sent the following elements with our <u>REQUEST</u>:</strong><br />
<ul>
    <li><em>ArtistID</em> - value was &quot;42028&quot;, an example ID from an artist</li>
</ul>
<br />
<strong>We got back the following array in <u>RESPONSE</u>:</strong><br />
<pre><? var_dump($GetArtistRadio); ?>
</pre>
<br />
<strong>We assign the array to  seperate variables and <u>OUTPUT</u> these (without any design here):</strong><br />
<?
    $ArtistID
= $GetArtistRadio['ArtistID'][0];
    
$ArtistRadioLoFiExists = $GetArtistRadio['ArtistRadioLoFiExists'][0];
    
$ArtistRadioHiFiExists = $GetArtistRadio['ArtistRadioHiFiExists'][0];
?>
<ul>
<li>Artist ID: <? echo $ArtistID; ?></li>
<li>Artist Radio LoFi Exists: <? echo $ArtistRadioLoFiExists; ?></li>
<li>Artist Radio HiFi Exists: <? echo $ArtistRadioHiFiExists; ?></li>
</ul>
</span>