Hello I am trying to create a php script that will allow me to remotely access my calendar (WebCalendar) without entering a username and password.
I have tried and tried but can't figure it out. Maybe somebody has any suggestions.
Here is what I was trying:
$url ="http://www.xxxx.com/calendar/login.php?";
$curlPost = 'login='.urlencode('xxxx').'&password='.urlencode('xxxx').'&submit=Login';
// set a handle and starts cURL session
$ch = curl_init();
// set the url
curl_setopt($ch, CURLOPT_URL, $url);
// return server header response
curl_setopt($ch, CURLOPT_HEADER, 1);
// don't send the response straight to the browser...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// send the form response via POST
curl_setopt($ch, CURLOPT_POST, 1);
// try any authentication
//curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'widget_cookie.txt');
curl_setopt ($ch, CURLOPT_POSTFIELDS, $curlPost);
$data = curl_exec ($ch);
curl_close ($ch);
echo $data;
and here is what the original form that I am trying to bypass looks like:
<form name="login_form" id="login" action="login.php" method="post"
onsubmit="return valid_form(this)">
<table cellpadding="10" align="center">
<tr><td rowspan="2">
<img src="login.gif" alt="Login" /></td><td align="right">
<label for="user">Username:</label></td><td>
<input name="login" id="user" size="15" maxlength="25"
value=""
tabindex="1" />
</td></tr>
<tr><td style="text-align:right;">
<label for="password">Password:</label></td><td>
<input name="password" id="password" type="password" size="15"
maxlength="30" tabindex="2" />
</td></tr>
<tr><td colspan="3" style="font-size: 10px;">
<input type="checkbox" name="remember" id="remember" tabindex="3"
value="yes" /><label for="remember">
Save login via cookies so I don't have to login next time</label>
</td></tr>
<tr><td colspan="4" style="text-align:center;">
<input type="submit" value="Login" tabindex="4" />
</td></tr>
</table>
</form>
Thanks a lot.