Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

By jdelacrix
Hi guys, I’m trying to create a new droplet using their API, but when I post the request, it returns blank. Here is my code.
<?php
$url = 'https://api.digitalocean.com/v2/droplets';
$data = 'name=TestDroplet®ion=ams3&size=512mb&image=449676322';
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
curl_setopt($ch,CURLOPT_HTTPHEADERS => array(
'Authorization: Bearer Authorization: Bearer MY KEY',
'Content-Type: application/json',
'Content-Length: ' . strlen($data)
));
//execute post
$result = curl_exec($ch);
print_r $result;
?>
Thanks.