API - GetOptimalUrls - incorrect name for consumerIP

Last post 01-25-2008 4:12 PM by BarryR. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 01-22-2008 10:15 AM

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

    API - GetOptimalUrls - incorrect name for consumerIP

    I was playing with the filesystem application for PHP and I was trying to restrict the download to an IP

    I noticed that in the call the parameter was called restrictedIP while in the API documentation it was called consumerIP

    I think is an error in the doc as in the file system application the restrictedIP parameter works (and it actually makes sense in terms of naming convention)

    hope it helps

    ciao Luca


     

    Filed under: ,
  • 01-25-2008 11:07 AM In reply to

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

    Re: API - GetOptimalUrls - incorrect name for consumerIP

     The PHP File Manager is using the call GetDownloadLinks to generate its links.  This method has been Deprecated and you should now use GetOptimalUrls which allows more functionality as well as offering the same functions that existed previously in the other call.  We haven't had a chance to update the sample applications with the new calls but should be able to do so soon.

    Regards,
         Barry R.

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
  • 01-25-2008 12:44 PM In reply to

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

    Re: API - GetOptimalUrls - incorrect name for consumerIP

    OK,
    I have added the following function to the class. It works, but feel free to double check..
    Btw, in php you can use the .= operator to do recursive value assignment to a variable, much quicker :-)
    ciao Luca 
     
        public function GetOptimalUrls($sessionToken, $filePaths, $expiration, $consumerIP, $ipRestricted)
    {
    global $DEBUG;
    global $IMFSHOST;

    // Set the parameters
    $filePathParams = 'sessionToken=' . $sessionToken . '&';
    $filePathParams .= 'expiration=' . $expiration . '&';
    $filePathParams .= 'consumerIP=' . $consumerIP . '&';
    $filePathParams .= 'ipRestricted=' . $ipRestricted. '&';

    // loop through each source file path building the arrray.
    foreach ($filePaths as $filePath)
    {
    $filePathParams .= 'filePath=' . $filePath . '&';
    }

    // retrieve from the REST interface the response xml.
    $xmlstring = curlGet($IMFSHOST . '/ws/IMFS/GetOptimalUrls.ashx?' . $filePathParams);

    if ($DEBUG)
    {
    print '<!--GetOptimalUrls: ';
    print($filePathParams);
    print_r($xmlstring);
    print '-->';
    }

    // turn into an object for easier handling.
    $xml = new SimpleXMLElement($xmlstring);

    return $xml;
    }


  • 01-25-2008 4:12 PM In reply to

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

    Re: API - GetOptimalUrls - incorrect name for consumerIP

     This looks good and worked for me.  I will integrate it into the next release of the Filemanager.  I appreciate all of your help cleaning up and improving the PHP applications.

    Thank you,
        Barry R.
     

    IM Support (Feel free to add me)

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