This is an archived forum post. The information may be outdated. Contact us if you have any questions.

PHP 5.5 & cURL '@filename API deprecated'

ajcos wrote on 2014-01-06:
For anyone recieving this message using the pdfcrowd PHP Library on PHP 5.5..
"The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class instead."

You will have to use the CurlFile Class in order to post a file using the "convertFile()" method.

This can be fixed by changing convertFile() method in the pdfcrowd php library, locate the following code in in the converFile() method..

        $this->fields['src'] = '@' . $src;
        $uri = $this->api_prefix . "/pdf/convert/html/";
        return $this->http_post($uri, $this->fields, $outstream);

Change it to this..

        //$this->fields['src'] = '@' . $src;
        $this->fields['src'] = new CurlFile($src, 'text/html');
        $uri = $this->api_prefix . "/pdf/convert/html/";
        return $this->http_post($uri, $this->fields, $outstream);

This will solve the problem. You can always comment out the new line and replace it with the other one for older versions of PHP. There could be an extra addaptation to detect the PHP version and decide how to deal with the file but i didn't feel this was necessary as it's a quick fix.
support wrote on 2014-01-07:

Thank you for your feedback. We will update the PHP client library.
support wrote on 2014-02-08:

We have just updated the PHP API client library.
You can download the latest version from

Thank you again for your feedback!