• 03-10-2016, 17:23:56
    #1
    Kimlik doğrulama veya yönetimden onay bekliyor.
    Hem kendimi api konusunda geliştirmek ve yazmış olduğum müşteri takip sistemi otomatikleştirmek istiyorum.

    Whm ve Cpanel apisi bilen arkadaşlar var mı?

    curl üzerinden login oluyor. token değeri alıyorum, diğer verileri gönderirken tokeni kullansamda bir sonraki bağlantı olmuyor, bağlantı başarısız dönüyor.

    Her seferinde tekrar whm veya cpanel user ve şifre göndermek zorunda kalıyorum.

    Yardımcı olur musun?
  • 03-10-2016, 20:54:58
    #2
    xmlapi araştırın. her işinizi görürsünüz. türkçe kaynağı yok ama cpanelin kendi dökümanları var inceleyebilirsiniz.
  • 18-09-2019, 12:30:20
    #3
    Belki bu fikir verebilir:

    <?
    $whmusername = "root";
    $whmpassword = "xxxxxxxxx";
    
    //hesap listele
    // $query = "https://xxx.xxx.xxx.xxx:2087/json-api/listaccts?api.version=1";
    //hesap ac
    // $query = "https://xxx.xxx.xxx.xxx:2087/json-api/createacct?api.version=1&username=kullanici&owner=hesapsahibi&password=xxxxxxxx&domain=example.com&contactemail=example@gmail.com&plan=whmhesapadi";
    
    
    $curl = curl_init(); // Create Curl Object
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0); // Allow self-signed certs
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0); // Allow certs that do not match the hostname
    curl_setopt($curl, CURLOPT_HEADER,0); // Do not include header in output
    curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); // Return contents of transfer on curl_exec
    $header[0] = "Authorization: Basic " . base64_encode($whmusername.":".$whmpassword) . "nr";
    curl_setopt($curl, CURLOPT_HTTPHEADER, $header); // set the username and password
    curl_setopt($curl, CURLOPT_URL, $query); // execute the query
    $result = curl_exec($curl);
    if ($result == false) {
    error_log("curl_exec threw error "" . curl_error($curl) . "" for $query");
    }
    curl_close($curl);
    print $result;
    
    ?>