Skip to content
Snippets Groups Projects
Commit 468b4752 authored by Tim Steiner's avatar Tim Steiner
Browse files

PodcastProducer script now uses wget instead of curl to upload files to the server.

parent 505dc8be
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,10 @@ class Unl_Service_PodcastProducer extends Zend_Service_Abstract
protected $_curl;
protected $_username;
protected $_password;
public function __construct($hostname, $port = 8170)
{
$this->_uri = Zend_Uri::factory('https');
......@@ -25,6 +29,9 @@ class Unl_Service_PodcastProducer extends Zend_Service_Abstract
public function authenticate($username, $password)
{
$this->_username = $username;
$this->_password = $password;
curl_setopt($this->_curl, CURLOPT_USERPWD, "$username:$password");
curl_setopt($this->_curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
}
......@@ -88,8 +95,9 @@ class Unl_Service_PodcastProducer extends Zend_Service_Abstract
public function createForFile(Unl_Service_PodcastProducer_Workflow $workflow, $filePath, $metadata = array())
{
$fileContents = file_get_contents($filePath);
$fileSize = strlen($fileContents);
//$fileContents = file_get_contents($filePath);
//$fileSize = strlen($fileContents);
$fileSize = 0;
$fileName = basename($filePath);
$uri = clone $this->_uri;
......@@ -104,7 +112,7 @@ class Unl_Service_PodcastProducer extends Zend_Service_Abstract
}
//header('Content-type: text/xml');
echo $response;
echo $response . "\n\n\n";
$r = DOMDocument::loadXML($response);
$xPath = new DOMXPath($r);
......@@ -112,6 +120,21 @@ class Unl_Service_PodcastProducer extends Zend_Service_Abstract
$uploadUri = $xPath->query('https_upload_url')->item(0)->textContent;
$UUID = $xPath->query('uuid')->item(0)->textContent;
$returnVal = null;
$response = null;
$cmd = 'wget '
. '-O - '
. '--no-check-certificate '
. '--user=' . $this->_username . ' '
. '--password=' . $this->_password . ' '
. "--header 'File-name: $fileName' "
. "--header 'Recording-UUID: $recordingUUID' "
. "--post-file '$filePath' "
. $uploadUri;
exec($cmd, $response, $returnVal);
$response = implode("\n", $response);
/*
curl_setopt($this->_curl, CURLOPT_URL, $uploadUri);
curl_setopt($this->_curl, CURLOPT_HTTPHEADER, array(
'File-name: ' . $fileName,
......@@ -120,6 +143,7 @@ class Unl_Service_PodcastProducer extends Zend_Service_Abstract
curl_setopt($this->_curl, CURLOPT_POST, true);
curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $fileContents);
$response = curl_exec($this->_curl);
*/
echo $response . "\n\n\n";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment