when I type into my browser: ' https://myemail:mypassword@api.hellosign.com/v3/account '
I get
{"account":{"account_id":"**************","email_address":"myemail","callback_url":null,"role_code":null}}
which appears to be a valid response.
I'm trying to implement this in php using the libcurl php library. I have the following, but get FALSE when I run var_dump on the $response variable. Any ideas on the settings for libcurl? I have tried urlencoding the entire string with and without base_64 encoding of the authentication substring 'myemail:mypassword. Thanks in advance:
$final_string= 'https://myemail:mypassword@api.hellosign.com/v3/account';
$curl = curl_init();
curl_setopt($curl, CURLOPT_USERAGENT, 'HelloSign-PHP');
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($curl, CURLOPT_URL, $final_string);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, self::$time_out);
$response = curl_exec($curl);
// Get the status code
$http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if(curl_exec($curl) === false)
{
echo 'Curl error: ' . curl_error($curl);
}
else
{
echo 'Operation completed without any errors';
}
curl_close($curl);
output is :
Curl error: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failedProblem connecting to HelloSign.
Try the following:
<?php
$api_key = 'YOUR_API_KEY';
$url = 'https://api.hellosign.com/v3/account';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, $api_key . ":"); // Normally you'd put a password after the colon, but you don't need it if you're using an API key
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$response_json = json_decode($response, true);
print_r($response_json);
curl_close($ch);
?>
Note: You don't need to use your API key (you can use your username and password, as commented above), but it's recommended. You can retrieve your API key here: https://www.hellosign.com/home/myAccount#api
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.