Guten Tag,
ich versuche gerade mittels der OVH API eine neue Mailingliste zu erstellen. Dazu nutze ich folgende Funktion:
PHP-Code:
function ovhApiCreateMailinglist ( $name , $ownerEmail , $moderatorMessage, $subscribeByModerator, $usersPostOnly, $replyTo ) {
$url = "https://eu.api.ovh.com/1.0/email/domain/{meine-domain.de}/mailingList";
$method = "POST";
$body = "";
$ovhTime = ovhApiGetTime();
$toSign = OVH_APP_SECRET . '+' . OVH_USER_KEY . '+' . $method . '+' . $url . '+' . $body . '+' . $ovhTime;
$hash = '$1$' . sha1( $toSign );
if ( ( $name == "" ) OR ( $ownerEmail == "" ) ) {
exit();
}
$curl = curl_init();
$postData = array (
'language' => 'de',
'name' => $name,
'options' => array (
'subscribeByModerator' => $subscribeByModerator,
'usersPostOnly' => $usersPostOnly,
'moderatorMessage' => $moderatorMessage
),
'ownerEmail' => $ownerEmail,
'replyTo' => $replyTo
);
$headers = array();
$headers[] = 'X-Ovh-Application:' . OVH_APP_KEY;
$headers[] = 'X-Ovh-Timestamp:' . $ovhTime;
$headers[] = 'X-Ovh-Signature:' . $hash;
$headers[] = 'X-Ovh-Consumer:' . OVH_USER_KEY;
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $url,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $postData
));
$result = curl_exec( $curl );
$result = json_decode( $result, true );
curl_close( $curl );
return $result;
}
Ich erhalte allerdings immer folgenden Fehler:
Code:
Array ( [message] => [options] DomainMlOptionsStruct Data is not a hash for a complex type )
Leider kann ich mit dieser Meldung nichts anfangen, auch Google hat mir nicht geholfen. Kennt jemand eine Lösung oder kann mir erklären was ein "DomainMlOptionsStruct" ist?
Ich freue mich über jede Antwort
Liebe Grüße
Tom