I'm creating very simple script to login to cpanel via CURL. The problem is that I can't get it working, only blank screen is displayed all the time. What is wrong here?
<?php
$login_info="user=my_username&pass=my_password";
$useragent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
$referer="http://my_domain.com/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, 1);
curl_setopt($ch, CURLOPT_URL, "http://my_domain.com:2082/login/");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $login_info);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION,1);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>
Really simple code, but it does not work for unknown reasons. If you have any ideas, it would be nice to hear.
Thank you.