The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class instead
I believe it's as simple as changing your '@'.$filePath
to use CurlFile instead.
$post = array('apikey' => 'key', 'mode' => 'document_photo', 'file' => new CurlFile($filePath));
The above worked for me.
Note: I work for HP.
Due to time pressure, I did a quick workaround when I integrated a third party API. You can find the code below.
$url: Domain and page to post to; for example http://www.snyggamallar.se/en/$params: array[key] = value format, just like you have in $post.
WARNING: Any value that begins with an @ will be treated as a file, which of course is a limitation. It does not cause any issues in my case, but please take it into consideration in your code.
static function httpPost($url, $params){ foreach($params as $k=>$p){ if (substr($p, 0, 1) == "@") { // Ugly $ps[$k] = getCurlFile($p); } else { $ps[$k] = utf8_decode($p); } } $ch = curl_init($url); curl_setopt ($ch, CURLOPT_POST, true); curl_setopt ($ch, CURLOPT_POSTFIELDS, $ps); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); $res = curl_exec($ch); return $res;}static function getCurlFile($filename){ if (class_exists('CURLFile')) { return new CURLFile(substr($filename, 1)); } return $filename;}