forked from ZerooCool/newbiecontest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontext.php
More file actions
47 lines (43 loc) · 1.06 KB
/
Copy pathcontext.php
File metadata and controls
47 lines (43 loc) · 1.06 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
40
41
42
43
44
45
46
47
<!DOCTYPE html>
<html>
<head>
<title><?= $titre ?></title>
<meta charset="UTF-8">
</head>
<body>
</body>
</html>
<?php
require_once "config.php";
function get($relativeUrl){
$c = curl_init(URL.$relativeUrl);
curl_setopt($c, CURLOPT_COOKIE, getCookies()) ;
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
$retour = curl_exec ($c);
curl_close($c);
return $retour;
}
function post($relativeUrl, $array){
// conversion de l'array en données post html
$fields_string = '';
foreach($array as $key=>$value){
$fields_string .= 'rep'.($key+1).'='.$value.'&';
}
rtrim($fields_string, '&');
$c = curl_init(URL.$relativeUrl);
curl_setopt($c, CURLOPT_POST, count($array));
curl_setopt($c, CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($c, CURLOPT_COOKIE, getCookies()) ;
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$retour = curl_exec ($c);
curl_close($c);
return $retour;
}
function getCookies(){
$cookies = "Cookie=".Cookie.";";
if(defined(PHPSESSID)){
$cookies .= "PHPSESSID=".PHPSESSID;
}
return $cookies;
}
?>