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
41
42
43
44
45
46
47
48
| <?php
// redirect url voor kiezen taal
$url = "http://www.elia.be/default.aspx"; //Controls/ChooseLanguage/ChooseLanguage.aspx";
//$postdata['ACTIONTARGET'] = 'CHANGELANG.NL';
$cookiejar = tempnam("", "FOO");
if ($cookiejar)
{
$ch = curl_init();
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookiejar);
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); // IE6
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_COOKIESESSION, true);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
//curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
curl_exec ($ch);
$url = "http://www.elia.be/Controls/ChooseLanguage/ChooseLanguage.aspx?url=%2fdefault.aspx";
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookiejar);
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); // IE6
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_COOKIESESSION, true);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$postdata['ACTIONTARGET'] = 'CHANGELANG.NL';
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
// taal gekozen
curl_exec($ch);
$newurl = "http://www.elia.be/default.aspx";
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookiejar);
curl_setopt ($ch, CURLOPT_URL, $newurl);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); // IE6
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt ($ch, CURLOPT_COOKIESESSION, true);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
}
echo $cookiejar;
?> |