diff --git a/examples/vanilla_php.php b/examples/vanilla_php.php new file mode 100644 index 0000000..bdf792c --- /dev/null +++ b/examples/vanilla_php.php @@ -0,0 +1,31 @@ + new CURLFile($file_path), + 'storefile' => 'false' + ); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + print("Converting...\n"); + $result = curl_exec($curl); + if (curl_getinfo($curl, CURLINFO_HTTP_CODE) == 200) { + file_put_contents("result.pdf", $result); + } else { + print("Server returned error:\n".$result."\n"); +} + } else { + print('File does not exist: '.$file_path."\n"); + } +?> diff --git a/lib/ConvertApi/ResultFile.php b/lib/ConvertApi/ResultFile.php index e84ec62..9ac2be6 100644 --- a/lib/ConvertApi/ResultFile.php +++ b/lib/ConvertApi/ResultFile.php @@ -36,7 +36,7 @@ function getFileSize() } /** - * @return string Converted file contents + * @return false|string Converted file contents */ function getContents() { @@ -57,4 +57,4 @@ function save($path) return ConvertApi::client()->download($this->getUrl(), $path); } -} \ No newline at end of file +}