Am trying to upload files logo.png to Pinata IPFS using curl and php. The Documentation is in javacript/Axios but am trying to do it in php
When I run the code below, it throws error
{"error":{"reason":"KEYS_MUST_BE_STRINGS","details":"pinata_api_key and pinata_secret_api_key must both be strings"}}
here is coding so far
$url = "https://api.pinata.cloud/pinning/pinFileToIPFS"; // Where to upload file to
$data = array(
'pinata_api_key' => '00xxxxxx',
'pinata_secret_api_key' => 'e1xxxxxxxxxxxxxxxxxxcccccccc');
$file = 'logo.png';
$data['file'] = $file;
//$data = new CURLFile($file, mime_content_type($file));
//file_get_contents();
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
echo $result = curl_exec($handle);
if (curl_errno($handle)) {
echo "CURL ERROR - " . curl_error($handle);
}
else {
// $info = curl_getinfo($handle);
// print_r($info);
echo $result;
}
curl_close($handle);