Skip to content

Instantly share code, notes, and snippets.

@polluterofminds
Created October 20, 2021 16:04
Show Gist options
  • Save polluterofminds/c63c6c9df714ff27aab92ecf7c910cc1 to your computer and use it in GitHub Desktop.
Save polluterofminds/c63c6c9df714ff27aab92ecf7c910cc1 to your computer and use it in GitHub Desktop.
Pinata PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://manage.pinata.cloud/api/v1/content',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('files'=> new CURLFILE('PATH TO FILE'),'cidVersion' => '1','wrapWithDirectory' => 'false','pinToIPFS' => 'true'),
CURLOPT_HTTPHEADER => array(
'x-api-key: {{api-key}}'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment