for an computer science project we have to build a website that presents our time schedules. So basically what we have to do, is login to this site and get the information out of the page you're directed to.
I've read a lot of posts and tried a lot with cURL, but nothing seems to work.
I got the forms to be filled out, but it looks as if the 'submit' button isn't clicked. This is what I've got:
<?php
$url="http://rooster.sgnphp.nl/infoweb/index.php";
$post_data['user'] = '105353';
$post_data['paswoord'] = '105353';
foreach ( $post_data as $key => $value)
{
$post_items[] = $key . '=' . $value;
}
$postdata = implode ('&', $post_items);
$ch = curl_init($url);
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_COOKIEJAR, cookie.txt);
curl_setopt ($ch, CURLOPT_COOKIEFILE, cookie.txt);
curl_setopt ($ch, CURLOPT_REFERER, $url);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt ($ch, CURLOPT_POST, 1);
$result = curl_exec ($ch);
echo $result;
curl_close($ch);
?>
The form which I tried to fill in looks like this:
<form action="/infoweb/index.php" method="post">
<input type="hidden" name="csrf" value="cec30a2ed764e956ed01f137e2f0705a">
<table>
<tbody><tr>
<td>
Gebruikersnaam:
</td>
<td>
<input class="mooi" style="color: #FF8080;" type="text" name="user" value="105353" onfocus="if (this.value =='username') this.value=''; this.style.color='#000000';" onkeydown="this.style.color='#000000';">
</td>
</tr>
<tr>
<td>
Wachtwoord:
</td>
<td>
<input class="mooi" style="margin-bottom: 2px; color: #FF8080;" type="password" name="paswoord" value="105353" onfocus="if (this.value =='wachtwoord') this.value=''; this.style.color='#000000';" onkeydown="this.style.color='#000000';">
</td>
</tr>
<tr>
<td>
<input type="hidden" name="login" value="loginform">
</td>
<td>
<input type="submit" class="mooi" value="inloggen"><br>
</td>
</tr>
</tbody></table>
</form>
So what happens is that the form is filled out, but I can't see the time schedule because (I think) I'm not officially logged in.
Can anybody please help me? I really need to get this to work so I can get on with the rest of my project, but I've been stuck on this for days.
Thanks