Remote Login to Webmin using PHP/cURL

1 post / 0 new
#1 Fri, 01/27/2012 - 12:02
darrenp

Remote Login to Webmin using PHP/cURL

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);