PDA

View Full Version : WHM script error for creating new domain


firefly
06-23-2005, 03:51 PM
Hi

I want to allow my sites registered members to be able to add new domains on my server. I have written the following script:

(Fisrt I declare the New Domain Form Variables)


$param01 = $REQUEST["param01"];
$param02 = $REQUEST["param02"];


etc.
Then I have the connection script:


$server = "http://www.myserver.net";
$port = 2086;
$file = "/scripts/wwwacct?sign=&plan=myplan_SubDomain&domain=$param01&username=$param02&...and so on...";
function getcontent($server, $port, $file)
{
$cont = "";
$ip = "my-server-ip-address";
$fp = fsockopen($ip, $port);
if (!$fp)
{
return "Unknown";
}
else
{
fputs($fp, "POST "/scripts/wwwacct?sign=&plan=myplan_SubDomain&domain=$param01&username=$param02&...and so on..."; HTTP/1.1\r\n");
fputs($fp, "Host: myserver.net\r\n");
fputs($fp, "Authorization: Basic ".base64_encode("username:password")."\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fwrite($fp, $out);
while (!feof($fp))
{
$cont .= fread($fp, 500);
}
fclose($fp);
$cont = substr($cont, strpos($cont, "\r\n\r\n") + 4);
return $cont;
}
}
echo getcontent("http://username:password@www.myserver.net", "2086", "/scripts/wwwacct?sign=&plan=myplan_SubDomain&domain=$param01&username=$param02&...and so on...";);


The form posts to the page containing this script (www.myserver.net/scripts/access.php) which calls the wwwacct script. My script connects to the server, opens the wwwacct page, but then gives me a message:


WWWAcct 9.2 (c) 1997-2004 cPanel, Inc.
Please use the this syntax
wwwacct
Account Creation Complete!!!


...but no account was created.

I've been hitting my head against this error for a week now - any help would be GREATLY appreciated!

Thanks!