Example #1
0
 /**
  * Do an xmlrpc call to server.
  *
  * @see yamm_api_xmlrpc_call()
  *
  * @param string $method
  *   Method to cal
  * @param ...
  *   Arbitrary parameters you want to send to.
  * 
  * @return mixed
  *   Same result as yamm_api_xmlrpc_call().
  */
 public function sendCall($method)
 {
     $args = func_get_args();
     $method = array_shift($args);
     array_unshift($args, $this->_tid);
     array_unshift($args, $method);
     array_unshift($args, $this->_server->getUrl());
     return call_user_func_array('yamm_api_xmlrpc_call', $args);
 }
Example #2
0
 /**
  * (non-PHPdoc)
  * @see Yamm_FileFetcher::_fetch()
  */
 public function _fetch($filepath)
 {
     $source_url = yamm_api_clean_url($this->_server->getUrl()) . $filepath;
     // Get file contents.
     if ($data = file_get_contents($source_url, FILE_BINARY)) {
         // Get a new temporary file name, for file creation.
         $tmp = file_directory_temp() . '/' . uniqid('yamm-');
         // If we go some content, return new file path as data.
         if (file_put_contents($tmp, $data) > 0) {
             // Free up some memory after copy.
             unset($data);
             return $tmp;
         } else {
             throw new Yamm_FileFetcher_CouldNotFetchException("Unable to save " . $source_url . " downloaded file as temporary file");
         }
     } else {
         throw new Yamm_FileFetcher_CouldNotFetchException("Unable to download file " . $source_url);
     }
 }