problem using API on the Command Line

Charles2

Verified User
Joined
Nov 29, 2005
Messages
10
Location
Anywhere
I used the CMD_API_SITE_BACKUP to create my
backup.php script. I can run it from a browser just fine and the backup will run. I can see the backup being completed as I refresh my browser while in File Manager.

I went to the CL and typed
php backup.php
while I was in the same directory as the file.
It just gave me another blank line.
I waited but it didn't work. PHP is fine on the command line as I can add a
PHP:
<?php echo "Tesing"; ?>
and see that just fine.

I am using the httpsocket.php class.
Here is my code that I have for it.

PHP:
<?php
error_reporting(E_ALL);

include 'httpsocket.php';

$sock = new HTTPSocket;
$sock->connect('mydomain.com',2222);
$sock->set_login('username','password');
$sock->set_method('POST');
$sock->query('/CMD_SITE_BACKUP',
	array(
		'action' => 'backup',
		'domain' => 'clksite.com',
		'select0' => 'domain',
		'select1' => 'subdomain',
           'select2' => 'email',
           'select3' => 'forwarder',
           'select4' => 'autoresponder',
           'select5' => 'vacation',
           'select6' => 'list',
           'select7' => 'emailsettings',
           'select8' => 'ftp',
           'select9' => 'ftpsettings',
           'select10' => 'database',
           	'create' => 'Create'
    ));

//$result = $sock->fetch_body();
//echo $result;
?>
Is there something that I am doing wrong here? Is my code ok?(I used the examples that came with the httpsocket.php)
The only problem that I ran into in the coding was for the "Create Backup" button which didn't have a name assigned to it so I left it like it was.

At first I did get some errors in the httpsocket.php but I commented them out. It was on line 306. The backukp still ran just fine from the browser even with the errors.
 
Last edited:

bjurg

New member
Joined
Jun 15, 2007
Messages
1
Location
Utrecht, The Netherlands
use GET

I had the same problem. It went better when I used GET i.s.o. POST. And used CMD_API_SITE_BACKUP i.s.o CMD_SITE_BACKUP. The last line with the create I left out.
 
Last edited:
Top