protected function setUp() { $status = 200; $results = ["result" => true]; $this->output = \Wistia\Resources\Output::createOutput($status, $results); }
/** * Post Curl Call * * @param $url - api url * @param $params - api parameters * @return wistia output object */ protected function _post($url, array $params = array()) { $q = http_build_query($params); $ch = \curl_init(); \curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); \curl_setopt($ch, CURLOPT_URL, $url); \curl_setopt($ch, CURLOPT_USERPWD, static::getBasicAuth()); \curl_setopt($ch, CURLOPT_POSTFIELDS, $q); \curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); \curl_setopt($ch, CURLOPT_POST, TRUE); $result = \curl_exec($ch); $h = \curl_getinfo($ch); $status = $h["http_code"]; // Check for errors and display the error message if ($errno = \curl_errno($ch)) { $error_message = \curl_strerror($errno); \curl_close($ch); throw new \Exception($error_message, 400); } \curl_close($ch); return \Wistia\Resources\Output::createOutput($status, $result); }