DA HTTPSOCKET Not Working

aydinkeskin

New member
Joined
Apr 26, 2020
Messages
5
PHP:
include 'httpsocket.php';
$server_ip="xxx.net";
$server_login="admin";
$server_pass="f79xxx0ki";
$server_host="127.0.0.1";
$server_ssl="Y";
$server_port=2222;



 
    $username='newreseller';
    $domain='domain.com';
    $email='[email protected]';
    $pass='password';
    $package='Full_Paket'; // package is created in admin panel
 
    echo "Creating user $username on $server_ip.... <br>\n";
 
    $sock = new HTTPSocket;
    if ($server_ssl == 'Y')
    {
        $sock->connect("ssl://".$server_host, $server_port);
    }
    else
    {
        $sock->connect($server_host, $server_port);
    }
 
    $sock->set_login($server_login,$server_pass);
 
    $sock->query('/CMD_ACCOUNT_RESELLER',
        array(
            'action' => 'create',
            'add' => 'Submit',
            'username' => $username,
            'email' => $email,
            'passwd' => $pass,
            'passwd2' => $pass,
            'domain' => $domain,
            'package' => $package,
            'ip' => 'shared',
            'notify' => 'yes'
        ));
 
    $result = $sock->fetch_parsed_body();
 

    var_dump($result);

    if ($result['error'] != "0")------------->98
    {
        echo "<b>Error Creating user $username on server $server_ip:<br>\n";
        echo $result['text']."<br>\n";---------------------------->101
        echo $result['details']."<br></b>\n";-------------------->102
    }
    else
    {
        echo "User $username created on server $server_ip<br>\n";
    }
 
    exit(0);

echo "Will connect to: ".($server_ssl == "Y" ? "https" : "http")."://".$server_host.":".$server_port."<br>\n";
 a


not working
Notice: Undefined index: error in /home/akepanel/public_html/directadmin/index.php on line 98 101 102
 
I tried these 3.0.4 and 3.0.2 I give the same error in 2 seconds, I did not try the others, I also try to give them information

thanks for the answer
 
the result has not changed again, I tried all of them one by one again the same lines give error


rows with errors


if ($result['error'] != "0")------------->98
{
echo "<b>Error Creating user $username on server $server_ip:<br>\n";
echo $result['text']."<br>\n";---------------------------->101
echo $result['details']."<br></b>\n";-------------------->102
}


var_dump never returns
 
rows with errors
Still. you are pointing to 3 lines which do not exist in the httpsocket mentioned, so where are these lines coming from? Did you create them yourself? Or where are these lines residing?

Edit: Ah never mind, it's not the http socket, you're using one of the examples which are causing the problem.
Could indeed be the examples are not valid anymore for current php versions, but I'm not sure about that.
 
Last edited:
I don't see this line of code anywhere in the examples or the socket, could that be causing it?
Code:
var_dump($result);
What happens if you comment or remove this one?
 
Back
Top