0
私はcpanelのawstatsページを表示するために実装しようとしています。私は自動的にcpanelにログインし、渡されたドメインのawstatsを表示したいと思います。私は、このために、次のコードを使用しますが、それは、ログインページに行くと、AWStatsのページcpanel awstatsが自動的にリダイレクト
$cp_user = "<username>";
$cp_pwd = "<password>";
$url = "https://xxxx:2083/login";
$cookies = "cookies.txt";
$ch=curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
//curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies); // Save cookies to
curl_setopt($ch, CURLOPT_POSTFIELDS, "user=$cp_user&pass=$cp_pwd");
curl_setopt($ch, CURLOPT_TIMEOUT, 100020);
$f = curl_exec($ch);
$h = curl_getinfo($ch);
curl_close($ch);
if ($f == true and strpos($h['url'],"cpsess"))
{
// Get the cpsess part of the url
$pattern="/.*?(\/cpsess.*?)\/.*?/is";
$preg_res=preg_match($pattern,$h['url'],$cpsess);
}
$token= $cpsess[1];
header('Locations: https://xxxx:2083'.$token.'/awstats.pl?config=<domain>&ssl=&lang=en');
これに何か問題があるのを示していないようですか?
返信いただきありがとうございました。つまり、これを実現する方法はありません。 –