Hallo,
Ik probeer mijn infoweb rooster van mijn school op te halen alleen lukt dat niet, dit is de code die ik gebruik:
Codeblok (index.php):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
$naam = -----;
$ww = -----;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, http://------/roostersinfoweb/infoweb/index.php);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, user= . $naam . &password= . $ww);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_COOKIEJAR, cookies.txt);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_USERAGENT, Roosterinfo/1.0);
curl_exec($ch);
curl_setopt($ch, CURLOPT_URL, http://-----/roostersinfoweb/infoweb/index.php);
$content = curl_exec($ch);
if($content === FALSE)
$img_content = Curl error: . curl_error($ch);
else
{
preg_match(#
if(!isset($rooster[1]))
$inhoud = Er is een fout opgetreden.;
else
$inhoud = $rooster[1];
}
echo $inhoud;
curl_close($ch);
?>
Ik krijg steeds Er is een fout opgetrden.
Weet iemand hoe ik dit moet oplossen of bestaat er al een php API hiervoor? Alvast bedankt.
Ik probeer mijn infoweb rooster van mijn school op te halen alleen lukt dat niet, dit is de code die ik gebruik:
Codeblok (index.php):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
$naam = -----;
$ww = -----;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, http://------/roostersinfoweb/infoweb/index.php);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, user= . $naam . &password= . $ww);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_COOKIEJAR, cookies.txt);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_USERAGENT, Roosterinfo/1.0);
curl_exec($ch);
curl_setopt($ch, CURLOPT_URL, http://-----/roostersinfoweb/infoweb/index.php);
$content = curl_exec($ch);
if($content === FALSE)
$img_content = Curl error: . curl_error($ch);
else
{
preg_match(#
(.*)
#, $content, $rooster);if(!isset($rooster[1]))
$inhoud = Er is een fout opgetreden.;
else
$inhoud = $rooster[1];
}
echo $inhoud;
curl_close($ch);
?>
Ik krijg steeds Er is een fout opgetrden.
Weet iemand hoe ik dit moet oplossen of bestaat er al een php API hiervoor? Alvast bedankt.