2 Metadata Functions for the IMFS.php

Last post 02-06-2008 3:48 PM by BarryR. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 02-06-2008 3:21 PM

    • mmania
    • Top 10 Contributor
    • Joined on 01-20-2008
    • Netherlands
    • Posts 91

    2 Metadata Functions for the IMFS.php

    I added these 2 functions to the IMFS.php

     in SetMetadata, the $metainfo variable is an array consisting of the several Key:Value pairs for the metadata to be set, so that several metadata can be set at the same time.

     The functions don't check for invalid chars so be warned and double check if it works for you

     hope it helps

    ciao Luca

        //Set Metadata for the file
        public function SetMetadata($sessionToken, $destFilePath, $metainfo)
        {
            global $DEBUG;
            global $IMFSHOST;
           
            // Set the parameters
            $filePathParams = 'sessionToken=' . $sessionToken . '&';
            $filePathParams .= 'path=' . urlencode($destFilePath) . '&';

            foreach ($metainfo as $metadata){
            $filePathParams .= 'metadata=' . $metadata. '&';
            }       
            // retrieve from the REST interface the response xml.
            $xmlstring = curlGet($IMFSHOST . '/ws/Metadata/SetMetadata.ashx?' . $filePathParams);
           
            if ($DEBUG)
            {
                print '<!--SetMetadata: '.$filePathParams ;
                print_r($xmlstring);
                print '-->';
            }
           
            // turn into an object for easier handling.
            $xml = new SimpleXMLElement($xmlstring);
           
            return $xml;
        }




        //Get Metadata for the file
        public function GetMetadata($sessionToken, $destFilePath)
        {
            global $DEBUG;
            global $IMFSHOST;
           
            // Set the parameters
            $filePathParams = 'sessionToken=' . $sessionToken . '&';
            $filePathParams .= 'path=' . urlencode($destFilePath) . '&';
                   
            // retrieve from the REST interface the response xml.
            $xmlstring = curlGet($IMFSHOST . '/ws/Metadata/GetMetadata.ashx?' . $filePathParams);
           
            if ($DEBUG)
            {
                print '<!--GetMetadata: '.$filePathParams ;
                print_r($xmlstring);
                print '-->';
            }
           
            // turn into an object for easier handling.
            $xml = new SimpleXMLElement($xmlstring);
           
            return $xml;
        }

     

    Filed under: , ,
  • 02-06-2008 3:48 PM In reply to

    • BarryR
    • Top 10 Contributor
    • Joined on 07-20-2007
    • San Diego
    • Posts 614

    Re: 2 Metadata Functions for the IMFS.php

     Once again thanks for your hard work on the PHP calls.  I will include these changes with the next release of the PHP File System Manager.

    I have made some changes to the PHP calls that use POST rather than GET for the next release that will take care of wierd characters and a few other issues in how parameters are encoded.

    Regards,
         Barry R.

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
Page 1 of 1 (2 items)