HTTPSocket Class

AtomicRax

Verified User
Joined
Oct 12, 2003
Messages
81
I am trying to disable an account through HTTPSocket. I have this:

PHP:
include ($DOCUMENT_ROOT . '/directadmin.php');
$sock = new HTTPSocket;
$sock->connect('$serveraddy',2222);

$sock->set_login("admin|webadmin","******");

$sock->set_method('GET');

$sock->query('/CMD_SELECT_USERS',array( 'select0' => '$qusername', 'suspend' => 'Suspend/Unsuspend'));
$result = $sock->fetch_result();

$html = $result;

Variables used:
$serveraddy = server address (ns1.atomicrax.net)
$qusername = user I want to disable

It doesn't work. I don't know if that's how I'm supposed to do it, I just tried it....

Anyone know how to fix this?
 
In PHP you can't put variables inside single quotes. Use double quotes.
 
Ok, I now have this...

PHP:
include ($DOCUMENT_ROOT . '/directadmin.php');
$sock = new HTTPSocket;
$sock->connect('$serveraddy',2222);

$sock->set_login("webadmin","*****");

$sock->set_method('POST');
$sock->query('/CMD_SELECT_USERS',
array(
'location' => 'CMD_SELECT_USERS',
'suspend' => 'Suspend',
'select0' => "$qusername"
));
$result = $sock->fetch_body();
echo $result;

Still nothing.
 
Check the contents of $sock->error:
PHP:
print_r($sock->error);
(after echo $result;)

Also, what kind of output is $result throwing?
 
Try getting rid of the $sock->set_method('POST'); line entirely.

Hmm... why are you logging in as "webadmin"?
 
I'm running low on ideas here. This is probably something silly though. You're sure the connect address is right? :)

Append
PHP:
echo $sock->result;
to your program and see what it has to say.
 
Got rid of the $sock->set_method('POST'); line, replaced the variable $serveraddy with the real address, ns1.atomicrax.net and added echo $sock->result; which says nothing.
 
Maybe this is the problem:
Pinging ns1.atomicrax.net [198.87.82.150]:

Ping #1: * [No response]
Ping #2: * [No response]
Ping #3: * [No response]
Ping #4: * [No response]

Done pinging ns1.atomicrax.net!
 
Bocacom disables all ping requests. The server works good, you just can't ping it. Do to the recent attacks that many people have been experiancing. Bocacom.net owns the datacenter my server is in.
 
AHHHHHHHHHHHHHH! I see the light!

Use
PHP:
$sock->connect("https://$serveraddy",2222);
 
Back
Top