From efd1c196a3fff38cd40bd6baf6cb01aa17bde192 Mon Sep 17 00:00:00 2001 From: Root BA Date: Fri, 26 May 2023 14:41:33 +0300 Subject: [PATCH 1/3] fix curl http params --- src/QencodeApiClient.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/QencodeApiClient.php b/src/QencodeApiClient.php index d44d601..6b87339 100755 --- a/src/QencodeApiClient.php +++ b/src/QencodeApiClient.php @@ -175,7 +175,7 @@ private function request($method, $path, array $params = [], $arrays = null) //echo $params."\n\n"; $curl = curl_init($url); - curl_setopt($curl, CURLOPT_USERPWD, $this->key); +// curl_setopt($curl, CURLOPT_USERPWD, $this->key); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); From 7f828b29eaf1013bae9d19ad3375dd6debe4f6a8 Mon Sep 17 00:00:00 2001 From: Root BA Date: Fri, 26 May 2023 14:43:33 +0300 Subject: [PATCH 2/3] add ./get_metadata2.php for testing --- examples/get_metadata2.php | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 examples/get_metadata2.php diff --git a/examples/get_metadata2.php b/examples/get_metadata2.php new file mode 100644 index 0000000..3238a5d --- /dev/null +++ b/examples/get_metadata2.php @@ -0,0 +1,51 @@ +getMetadata($video_url); + echo "\nVideo info"; + list($width, $height) = Metadata::get_video_dimensions($video_info); + log_message('width, px: '.$width); + log_message('height, px: '.$height); + + $bitrate = Metadata::get_bitrate($video_info); + log_message('bitrate, b/s: '.$bitrate); + + $framerate = Metadata::get_framerate($video_info); + log_message('framerate, fps: '.$framerate); + + $duration = Metadata::get_duration($video_info); + log_message('duration, sec: '.$duration); + //echo "DONE!"; + +} catch (QencodeClientException $e) { + // We got some inconsistent state in client application (e.g. task_token not found when requesting status) + log_message('Qencode Client Exception: ' . $e->getCode() . ' ' . $e->getMessage()); +} catch (QencodeApiException $e) { + // API response status code was not successful + log_message('Qencode API Exception: ' . $e->getCode() . ' ' . $e->getMessage()); +} catch (QencodeException $e) { + // API call failed + log_message('Qencode Exception: ' . $e->getMessage()); + var_export($q->getLastResponseRaw()); +} + +function log_message($msg) { + echo $msg."\n"; +} \ No newline at end of file From 73d8cd4bf1f678ed440c89633b571710690b8c65 Mon Sep 17 00:00:00 2001 From: Root BA Date: Fri, 30 Jun 2023 21:09:30 +0300 Subject: [PATCH 3/3] fix // and user_name->api_key, see https://qencode.atlassian.net/browse/QCD-344 --- examples/get_metadata.php | 2 +- examples/get_metadata2.php | 51 -------------------------------------- src/QencodeApiClient.php | 5 ++-- 3 files changed, 4 insertions(+), 54 deletions(-) delete mode 100644 examples/get_metadata2.php diff --git a/examples/get_metadata.php b/examples/get_metadata.php index 63016dc..87414ac 100644 --- a/examples/get_metadata.php +++ b/examples/get_metadata.php @@ -8,7 +8,7 @@ use Qencode\Classes\Metadata; // Replace this with your API key -$apiKey = 'abcde12345'; +$apiKey = '1234567890123'; $video_url = 'https://nyc3.s3.qencode.com/qencode/bbb_30s.mp4'; $q = new QencodeApiClient($apiKey); diff --git a/examples/get_metadata2.php b/examples/get_metadata2.php deleted file mode 100644 index 3238a5d..0000000 --- a/examples/get_metadata2.php +++ /dev/null @@ -1,51 +0,0 @@ -getMetadata($video_url); - echo "\nVideo info"; - list($width, $height) = Metadata::get_video_dimensions($video_info); - log_message('width, px: '.$width); - log_message('height, px: '.$height); - - $bitrate = Metadata::get_bitrate($video_info); - log_message('bitrate, b/s: '.$bitrate); - - $framerate = Metadata::get_framerate($video_info); - log_message('framerate, fps: '.$framerate); - - $duration = Metadata::get_duration($video_info); - log_message('duration, sec: '.$duration); - //echo "DONE!"; - -} catch (QencodeClientException $e) { - // We got some inconsistent state in client application (e.g. task_token not found when requesting status) - log_message('Qencode Client Exception: ' . $e->getCode() . ' ' . $e->getMessage()); -} catch (QencodeApiException $e) { - // API response status code was not successful - log_message('Qencode API Exception: ' . $e->getCode() . ' ' . $e->getMessage()); -} catch (QencodeException $e) { - // API call failed - log_message('Qencode Exception: ' . $e->getMessage()); - var_export($q->getLastResponseRaw()); -} - -function log_message($msg) { - echo $msg."\n"; -} \ No newline at end of file diff --git a/src/QencodeApiClient.php b/src/QencodeApiClient.php index 6b87339..b0dbd33 100755 --- a/src/QencodeApiClient.php +++ b/src/QencodeApiClient.php @@ -22,8 +22,9 @@ class QencodeApiClient private $lastResponseRaw; private $lastResponse; - - public $url = 'https://api.qencode.com/'; +// fix "POST //v1/access_token HTTP/1.0" +// public $url = 'https://api.qencode.com/'; + public $url = 'https://api.qencode.com'; public $version = 'v1'; private $supported_versions = array('v1', 'v1.1');