2016-05-06 3 views
0

Ich versuche, ein E-Mail-Konto über Skript ohne Anmeldung in der cpanel zu erstellen. Hier ist das Skript Icpanel E-Mail-Konto Erstellung Problem

http://www.zubrag.com/scripts/cpanel-create-email-account.php

Hosting-Provider verwende ist Bluehost

ich diese Störung erhalte

Cannot create email account. Possible reasons: "fopen" function allowed on your server, PHP is running in SAFE mode 

abgesicherten Modus aus in meiner INI-Datei ist. Hier

ist der Berechtigungsnachweis-Bereich, dass das Skript

// cPanel info 
$cpuser = 'example.com'; // cPanel username 
$cppass = 'my_cpanel_pass'; // cPanel password 
$cpdomain = 'example.com'; // cPanel domain or IP 
$cpskin = 'x'; // I have tried x and also bluehost here 

// Default email info for new email accounts 
// These will only be used if not passed via URL 
$epass = 'my_cpanel_pass'; // email password 
$edomain = 'example.com'; // email domain (usually same as cPanel domain above) 
$equota = 20; // amount of space in megabytes 

Der folgende Code verwendet sendet mir die Fehler/Warnungen

$f = fopen ("http://$cpuser:[email protected]$cpdomain:2082/frontend/$cpskin/mail/doaddpop.html?email=$euser&domain=$edomain&password=$epass&quota=$equota", "r"); 
    if (!$f) { 
    $msg = 'Cannot create email account. Possible reasons: "fopen" function allowed on your server, PHP is running in SAFE mode'; 
    break; 
    } 

Die Warnung Ich erhalte ist

Warning: fopen(http://[email protected]:2082/frontend/x/mail/doaddpop.html?email=asif.k&domain=example.com&password=SmallAn123!&quota=20): failed to open stream: HTTP request failed! HTTP/1.1 401 Access Denied in E:\Web Softs\wamp\www\clnt5\cpemail.php on line 81 

Wenn ich alle Sachen zwischen fopen() drucke bekomme ich diese

http://cpanel_user_name:[email protected]:2082/frontend/x/mail/doaddpop.html?email=asif.k&domain=mydomain.com&password=SmallAn123!&quota=20 

Ich habe viel gegooglet, um dies zu beheben. Jede Hilfe oder ein anderes Skript, das mir dabei helfen kann, wird sehr geschätzt.

+0

Sollte nicht die URL sein 'http: // cpanel_user_name: [email protected]: 2082/...' – Jamesking56

+0

leider mein Fehler. Die URL entspricht der von Ihnen angegebenen URL. aber dieses Skript hat mich wirklich genervt –

+0

Ich glaube nicht, cPanel können Sie automatisieren Hinzufügen von E-Mail-Konten, ich denke, Sie müssen stattdessen WHM dafür verwenden. – Jamesking56

Antwort

0

Wenn Sie cpanel Benutzernamen und Passwort haben, sollten Sie cpanel API verwenden, um E-Mail-Konten und für viele weitere Funktionen zu erstellen, anstatt diese Anfrage zu erhalten.

 require_once 'xmlapi.php'; 
     $xmlapi = new \xmlapi($cpanel_domain); 

     $xmlapi->password_auth($cpanel_username,$cpanel_password); 

     $xmlapi->set_port('your domain port will be here'); 

     $api2args = array();        
     $result = $xmlapi->api1_query($cpanel_password, 'CustInfo', 'getemail', $api2args); 
     // until here you will get confirmation of your connected cpanel with cpanel api 
     // then create cpanel as below 
      $api2args = array(
      'domain'   => $domain, 
      'email'   => $email_address_to_create, 
      'password'  => $email_password, 
      'quota'   => '2048', // quota for email you want to set       
      ); 
      $result = $xmlapi->api2_query($cpanel_username, 'Email', 'addpop', $api2args); 

     if(isset($result->error) && $result->error!=""){     
      // error can be recorded here 
     } 
     else{ 
      // email account get created 
     }