Menu

[r1]: / ressource / kadanza / ecolo_login.php  Maximize  Restore  History

Download this file

39 lines (33 with data), 1.3 kB

 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
<?php
$ckfile = tempnam("/tmp", "CURLCOOKIE");
$url = "http://portal.kinsyp.local/kadanza/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
/*curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, $ckfile);
curl_setopt($ch, CURLOPT_COOKIEFILE, $ckfile);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
//curl_setopt($curl, CURLOPT_COOKIE, session_name() . '=' . session_id());
$html = curl_exec($ch);*/
$postfields = array();
$postfields["user"] = "uniwan";
$postfields["pass"] = "uniwan";
$postfields["logintype"] = "login";
$postfields["pid"] = "20";
$useragent = "Mozilla/5.0";
curl_setopt($ch, CURLOPT_COOKIEFILE,$ckfile);
curl_setopt($ch, CURLOPT_COOKIEJAR,$ckfile);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
//curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
//curl_setopt($curl, CURLOPT_COOKIE, session_name() . '=' . session_id());
$result = curl_exec($ch);
$last_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
echo $result
?>