Hello,
I have a problem with adding many domains at once by php script, I use script found in internet, it works only on one hosting, on any other it can't login properly, what can be the reason?:
<?
set_time_limit(0);
function get_page ($url,$var,$proxy,$ref)
{
$ch = curl_init();
if(isset($proxy))
curl_setopt ($ch, CURLOPT_PROXY, $proxy);
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0");
curl_setopt ($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE,"cookie.txt");
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT, 400);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $var);
curl_setopt($ch, CURLOPT_REFERER, $ref);
$result = curl_exec ($ch);
curl_close($ch);
return $result;
}
$ip="my_hosting_ip";
$username="my_user";
$password="my_password";
$result=get_page ("http://".$ip.":2222/CMD_LOGIN","referer=%2FCMD_ADDITIONAL_DOMAINS%3F&username=".$username."&password=".$password,"","http://".$ip.":2222/CMD_ADDITIONAL_DOMAINS?");
$bufer="";
$file=fopen("dom.txt","r"); //domains are located here
while(!feof($file))
{
$bufer=fgets($file,100);
$bufer=ereg_replace("\n", "", $bufer);
$bufer=ereg_replace("\r", "", $bufer);
$result=get_page ("http://".$ip.":2222/CMD_DOMAIN","action=create&domain=". $bufer."&ubandwidth=unlimited&uquota=unlimited&cgi=ON&php=ON","","");
print $bufer." – ".$result;
}
fclose ($file);
?>
I have a problem with adding many domains at once by php script, I use script found in internet, it works only on one hosting, on any other it can't login properly, what can be the reason?:
<?
set_time_limit(0);
function get_page ($url,$var,$proxy,$ref)
{
$ch = curl_init();
if(isset($proxy))
curl_setopt ($ch, CURLOPT_PROXY, $proxy);
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0");
curl_setopt ($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE,"cookie.txt");
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT, 400);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $var);
curl_setopt($ch, CURLOPT_REFERER, $ref);
$result = curl_exec ($ch);
curl_close($ch);
return $result;
}
$ip="my_hosting_ip";
$username="my_user";
$password="my_password";
$result=get_page ("http://".$ip.":2222/CMD_LOGIN","referer=%2FCMD_ADDITIONAL_DOMAINS%3F&username=".$username."&password=".$password,"","http://".$ip.":2222/CMD_ADDITIONAL_DOMAINS?");
$bufer="";
$file=fopen("dom.txt","r"); //domains are located here
while(!feof($file))
{
$bufer=fgets($file,100);
$bufer=ereg_replace("\n", "", $bufer);
$bufer=ereg_replace("\r", "", $bufer);
$result=get_page ("http://".$ip.":2222/CMD_DOMAIN","action=create&domain=". $bufer."&ubandwidth=unlimited&uquota=unlimited&cgi=ON&php=ON","","");
print $bufer." – ".$result;
}
fclose ($file);
?>