コード例 #1
0
 function xmlrpc2php($d)
 {
     if ($d->kindOf() == "scalar") {
         return $d->scalarval();
     } elseif ($d->kindOf() == "array") {
         $a = array();
         for ($i = 0; $i < $d->arraysize(); $i++) {
             $a[$i] = XML_RPC_PLN::xmlrpc2php($d->arraymem($i));
         }
         return $a;
     } elseif ($d->kindOf() == "struct") {
         $a = array();
         while (list($k, $v) = $d->structeach()) {
             $a[$k] = XML_RPC_PLN::xmlrpc2php($v);
         }
         return $a;
     }
     //error ?
     return "";
 }
コード例 #2
0
ファイル: irate.php プロジェクト: BackupTheBerlios/irate-svn
function IRS_xmlrpc_getInfo($params)
{
    global $IRS;
    $IRS->requireAuth();
    $p = $params->getParam(0);
    $r1 = XML_RPC_PLN::xmlrpc2php($p);
    return new XML_RPC_Response($IRS->getTrackXMLRPCbyArray($r1));
}
コード例 #3
0
    $rated_tracks = XML_RPC_PLN::xmlrpc2php($rep->value());
    echo "<!-- XMLRPC CALL : \n" . $msg->serialize() . "\n -->";
    //debug
    //for each rated track, get metadata
    for ($i = 0; $i < count($rated_tracks); $i++) {
        $tracks_ids[$i] = array("id" => $rated_tracks[$i]["id"]);
    }
    $msg = new XML_RPC_Message("irate.getInfo", array(XML_RPC_PLN::php2xmlrpc($tracks_ids)));
    $rep = $XMLRPC->send($msg);
    $tracks_metadata = XML_RPC_PLN::xmlrpc2php($rep->value());
    echo "<!-- XMLRPC CALL : \n" . $msg->serialize() . "\n -->";
    //debug
    //ask for one new track
    $msg = new XML_RPC_Message("irate.getNew", array(XML_RPC_PLN::php2xmlrpc(array("n" => 1))));
    $rep = $XMLRPC->send($msg);
    $new_track = XML_RPC_PLN::xmlrpc2php($rep->value());
    echo "<!-- XMLRPC CALL : \n" . $msg->serialize() . "\n -->";
    //debug
    //that's it ! now we only need to display the tracks.
    ?>

<table border=1>
<tr>
 <th>Track name</th>
 <th>Artist name</th>
 <th>Crediturl</th>
 <th>Duration</th>
 <th>Rated</th>
 <th>Rate again ?</th>
</tr>