Hello,
anybody could make php that will create domains from a file txt, for example i need to add 50domains, is it possible?
cheers.
include('httpsocket.php');
// init
$username = 'user';
$domain = 'domain.com';
$pass = 'password';
$path = "/domains/".$domain."/public_html/myfile.tar.gz";
$sock = new HTTPSocket;
$sock->connect($domain, 2222);
$sock->set_login($username, $pass);
$data = array(
'path' => $path,
'action' => 'extract',
'page' => 2
);
$sock->query('/CMD_API_FILE_MANAGER', $data);
$result = $sock->fetch_parsed_body();
print_r($result);
$data = array(
'path' => $path,
'directory' => '/',
'action' => 'extract',
'page' => 2
);
include('httpsocket.php');
// init
$username = 'user';
$domain = 'domain.com';
$pass = 'password';
$path = "/domains/".$domain."/public_html/";
$file = "myfile.zip";
$sock = new HTTPSocket;
$sock->connect($domain, 2222);
$sock->set_login($username, $pass);
$sock->set_method('POST');
$data = array(
'enctype' => "multipart/form-data",
'action' => 'upload',
'path' => $path,
'file1' => $file
);
$sock->query('/CMD_API_FILE_MANAGER', $data);
$result = $sock->fetch_parsed_body();
print_r($result);
Upload a file:
method must be POST
enctype="multipart/form-data" .. must encode it properly.
action=upload
path=/path/you're/uploadingto
file1=filename
... this isn't straight forward, you'll need to lookup up how a browser sends/encodes the files to duplicate this.
Post string: MAX_FILE_SIZE=10485760&action=upload&file1=/home/tmp/my_file1.tar.gzE0ChMS&file2=/home/tmp/my_file2.tar.gz0qS2n0&path=/private
1. do i need to have any port open from my server end?
2. it's possible to do any API connection with an User Level?
3. when i try to run the script, the page is loading for 1 minuet or so an then error couldn't show page.
please help me.
Thank You.
<?php
$domain = "domain";
$user = "username";
$pass = "password";
include 'httpsocket.php';
$sock = new HTTPSocket;
$sock->connect($domain,2223);
$sock->set_login($user,$pass);
$sock->set_method('POST');
$sock->query('/CMD_SITE_BACKUP',
array(
'domain' => $domain,
'action' => 'backup',
'select0' => 'domain',
'select1' => 'subdomain',
'select2' => 'email',
'select3' => 'forwarder',
'select4' => 'autoresponder',
'select5' => 'vacation',
'select6' => 'list',
'select7' => 'emailsettings',
'select8' => 'ftp',
'select9' => 'ftpsettings',
'select10' => 'database'
));
$result = $sock->fetch_body();
if (strpos($result,'Backup creation added to queue') !== false) {
echo 'success';
} else {
echo 'fail';
}
?>