Script cURl API: message“:”Invalid signature”

65 views Asked by At

I use curl to test the availability of a domain name but there is a problem with the ovh signature here is the error messageenter image description here and here is the code I get, I also put my file on a server also nothing I tried with the commen signature indicated in the ovh documentation but without solution

<?php 
 
$applicationKey = "";
$applicationSecret = "";
$consumerKey = "";
$domaineAVerifier = "google.com";
$url = "https://eu.api.ovh.com/1.0/domain/zone/{$domaineAVerifier}/status";

$method = "GET";
$nSTime = time();


$sTosign = $applicationSecret . "+" . $consumerKey . "+" . $method . "+" . $url . "+" . $nSTime;
$sTmp = hash('sha1', $sTosign);

$sTmp = strtolower(str_replace([' ', "\r\n"], '', $sTmp));
$signature = "$1$" . $sTmp;

$ch = curl_init($url);


$options = array(
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => array(
        "X-Ovh-Application: $applicationKey",
        "X-Ovh-Consumer: $consumerKey",
        "X-Ovh-Signature: $signature",
        "X-Ovh-Timestamp: $nSTime",
    ),
    CURLOPT_URL => $url, 
);

curl_setopt_array($ch, $options);


$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Erreur cURL : ' . curl_error($ch);
} else {

    echo $response;
}


curl_close($ch);

?>
0

There are 0 answers