I've figured out how to use the php curl functions to automatically log into 2 different radios but am having trouble with netgear routers.
The problem is that its login screen consists of a popup window where you enter user/pass and I can't figure out how to process it with the php curl functions.
I tried addingcurl_setopt($ch, CURLOPT_USERPWD, "username:password");
as suggested in an answer to this question post,
but it just returned an "invalid login" screen (before, it would just hang at this point so I suppose it is an improvement).
I also tried adding both curl_setopt($curl_conn, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
andcurl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
before it and turning CURLOPT_FOLLOWLOCATION on and off but same result.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $LoginPage);//IP Address followed by :8080
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($curl_conn, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, $Username . ":" . $Password);
$data = curl_exec($ch);
Update(2018/2/5):
The following gave me part of the settings page for the router! I'll probably have to mess with the html/javascript to get the rest...
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);//10 seconds
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);//kept trying options till it worked
curl_setopt($ch, CURLOPT_USERPWD, "$Username:$Password");
$result = curl_exec($ch);
//$resultStatus = curl_getinfo($ch);
//print 'ResultStatus:'.print_r($resultStatus) . "<br>";
curl_close($ch);
echo($result);