Skip to content
Advertisement

How to create droplet with digital ocean api v2?

I want to create droplet but I am getting error in curl_close(). How can I create droplet ? It is giving me error like:

JavaScript

This is my code:

JavaScript

Advertisement

Answer

You’re trying to curl_close the result of the curl_exec which is FALSE on failure, or TRUE. In your case since you used CURLOPT_RETURNTRANSFER, it’s the result of your execution.

JavaScript

Relevant PHP documentation:

Description

curl_exec ( CurlHandle $handle ) : string|bool

Execute the given cURL session.

This function should be called after initializing a cURL session and all the options for the session are set.

Parameters

handle – A cURL handle returned by curl_init().

Return Values

Returns true on success or false on failure. However, if the CURLOPT_RETURNTRANSFER option is set, it will return the result on success, false on failure.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement