Remote Login to Webmin using PHP/cURL

  • darrenp
  • 01/26/12
  • Offline
Posted: Fri, 2012-01-27 13:02

Hey,

I'm wondering if anyone has tried this? I keep getting "your server does not support cookies" back... here's my cURL code:

$ch = curl_init();

$headers[] = "Connection: Keep-Alive";

curl_setopt($ch, CURLOPT_URL, "https://$server-ip:10000/session_login.cgi?user=$user&pass=$pass");

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

curl_setopt($ch, CURLOPT_COOKIEJAR, "/path/to/tmp/test_cookie.txt");

curl_setopt($ch, CURLOPT_REFERER, "https://$server-ip:10000/");

$r = curl_exec($ch);

curl_close($ch);

die($r);