I’d like to perform both “storage” and “delete” commands on single images from my server using PHP. Since these seem like they should be simple operations, I’d like to just use the REST API directly and not use the uploadcare PHP lib if possible. (It’s just one more github package I’d have to worry about keeping up with changes on, etc.)
I’m not super fluent with CURL, so I was hoping someone could tell me how to perform the following command using PHP.
Just in case someone else has a similar need, this is what ended up working for me:
$cSession = curl_init();
curl_setopt($cSession, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($cSession, CURLOPT_HTTPHEADER, array('Authorization: Uploadcare.Simple demopublickey:demoprivatekey'));
$result = curl_exec($cSession); // $result holds details about the file that was stored
$status = curl_getinfo($cSession, CURLINFO_HTTP_CODE); // $status will be 200 if the api call was successful