I am trying the example code and it works sometimes, but most of the time it gives me a not responding error. Is there a way to fix this? Also, when I actually do get logged in, I add "https://$htusername:$htpassword@$server:2083" to all images so it does not prompt for a password. Is this a security issue and/or is there a better way of doing this? Thanks.
Code:
<?
$htusername = urlencode("USERNAME");
$htpassword = urlencode("PASSWORD");
$server = "WWW.MYDOMAIN.COM";
$ch = null;
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT,3);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_URL,"https://$htusername:$htpassword@$server:2083/");
if ($buffer = curl_exec($ch)) {
$test = str_replace("/cPanel_magic_revision_","https://$htusername:$htpassword@$server:2083/cPanel_magic_revision_",$buffer);
print $test;
} else {
print $server.": Not responding.\n";
}
curl_close($ch);
?>