Robin Thoni před 8 roky
revize
a785f1aaa3
5 změnil soubory, kde provedl 337 přidání a 0 odebrání
  1. 3
    0
      .gitignore
  2. 14
    0
      composer.json
  3. 290
    0
      composer.lock
  4. 2
    0
      example.env
  5. 28
    0
      index.php

+ 3
- 0
.gitignore Zobrazit soubor

@@ -0,0 +1,3 @@
1
+/vendor
2
+/.idea
3
+/.env

+ 14
- 0
composer.json Zobrazit soubor

@@ -0,0 +1,14 @@
1
+{
2
+    "name": "robin.thoni/uqac",
3
+    "type": "project",
4
+    "authors": [
5
+        {
6
+            "name": "Robin THONI",
7
+            "email": "robin@rthoni.com"
8
+        }
9
+    ],
10
+    "require": {
11
+        "guzzlehttp/guzzle": "~6.0",
12
+        "vlucas/phpdotenv": "^2.3"
13
+    }
14
+}

+ 290
- 0
composer.lock Zobrazit soubor

@@ -0,0 +1,290 @@
1
+{
2
+    "_readme": [
3
+        "This file locks the dependencies of your project to a known state",
4
+        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5
+        "This file is @generated automatically"
6
+    ],
7
+    "hash": "0e6e018c30b6e92e0228031be8bc3fea",
8
+    "content-hash": "6765fea4ae77051ea2948dfcef66a943",
9
+    "packages": [
10
+        {
11
+            "name": "guzzlehttp/guzzle",
12
+            "version": "6.2.1",
13
+            "source": {
14
+                "type": "git",
15
+                "url": "https://github.com/guzzle/guzzle.git",
16
+                "reference": "3f808fba627f2c5b69e2501217bf31af349c1427"
17
+            },
18
+            "dist": {
19
+                "type": "zip",
20
+                "url": "https://api.github.com/repos/guzzle/guzzle/zipball/3f808fba627f2c5b69e2501217bf31af349c1427",
21
+                "reference": "3f808fba627f2c5b69e2501217bf31af349c1427",
22
+                "shasum": ""
23
+            },
24
+            "require": {
25
+                "guzzlehttp/promises": "^1.0",
26
+                "guzzlehttp/psr7": "^1.3.1",
27
+                "php": ">=5.5"
28
+            },
29
+            "require-dev": {
30
+                "ext-curl": "*",
31
+                "phpunit/phpunit": "^4.0",
32
+                "psr/log": "^1.0"
33
+            },
34
+            "type": "library",
35
+            "extra": {
36
+                "branch-alias": {
37
+                    "dev-master": "6.2-dev"
38
+                }
39
+            },
40
+            "autoload": {
41
+                "files": [
42
+                    "src/functions_include.php"
43
+                ],
44
+                "psr-4": {
45
+                    "GuzzleHttp\\": "src/"
46
+                }
47
+            },
48
+            "notification-url": "https://packagist.org/downloads/",
49
+            "license": [
50
+                "MIT"
51
+            ],
52
+            "authors": [
53
+                {
54
+                    "name": "Michael Dowling",
55
+                    "email": "mtdowling@gmail.com",
56
+                    "homepage": "https://github.com/mtdowling"
57
+                }
58
+            ],
59
+            "description": "Guzzle is a PHP HTTP client library",
60
+            "homepage": "http://guzzlephp.org/",
61
+            "keywords": [
62
+                "client",
63
+                "curl",
64
+                "framework",
65
+                "http",
66
+                "http client",
67
+                "rest",
68
+                "web service"
69
+            ],
70
+            "time": "2016-07-15 17:22:37"
71
+        },
72
+        {
73
+            "name": "guzzlehttp/promises",
74
+            "version": "1.2.0",
75
+            "source": {
76
+                "type": "git",
77
+                "url": "https://github.com/guzzle/promises.git",
78
+                "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579"
79
+            },
80
+            "dist": {
81
+                "type": "zip",
82
+                "url": "https://api.github.com/repos/guzzle/promises/zipball/c10d860e2a9595f8883527fa0021c7da9e65f579",
83
+                "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579",
84
+                "shasum": ""
85
+            },
86
+            "require": {
87
+                "php": ">=5.5.0"
88
+            },
89
+            "require-dev": {
90
+                "phpunit/phpunit": "~4.0"
91
+            },
92
+            "type": "library",
93
+            "extra": {
94
+                "branch-alias": {
95
+                    "dev-master": "1.0-dev"
96
+                }
97
+            },
98
+            "autoload": {
99
+                "psr-4": {
100
+                    "GuzzleHttp\\Promise\\": "src/"
101
+                },
102
+                "files": [
103
+                    "src/functions_include.php"
104
+                ]
105
+            },
106
+            "notification-url": "https://packagist.org/downloads/",
107
+            "license": [
108
+                "MIT"
109
+            ],
110
+            "authors": [
111
+                {
112
+                    "name": "Michael Dowling",
113
+                    "email": "mtdowling@gmail.com",
114
+                    "homepage": "https://github.com/mtdowling"
115
+                }
116
+            ],
117
+            "description": "Guzzle promises library",
118
+            "keywords": [
119
+                "promise"
120
+            ],
121
+            "time": "2016-05-18 16:56:05"
122
+        },
123
+        {
124
+            "name": "guzzlehttp/psr7",
125
+            "version": "1.3.1",
126
+            "source": {
127
+                "type": "git",
128
+                "url": "https://github.com/guzzle/psr7.git",
129
+                "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b"
130
+            },
131
+            "dist": {
132
+                "type": "zip",
133
+                "url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b",
134
+                "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b",
135
+                "shasum": ""
136
+            },
137
+            "require": {
138
+                "php": ">=5.4.0",
139
+                "psr/http-message": "~1.0"
140
+            },
141
+            "provide": {
142
+                "psr/http-message-implementation": "1.0"
143
+            },
144
+            "require-dev": {
145
+                "phpunit/phpunit": "~4.0"
146
+            },
147
+            "type": "library",
148
+            "extra": {
149
+                "branch-alias": {
150
+                    "dev-master": "1.4-dev"
151
+                }
152
+            },
153
+            "autoload": {
154
+                "psr-4": {
155
+                    "GuzzleHttp\\Psr7\\": "src/"
156
+                },
157
+                "files": [
158
+                    "src/functions_include.php"
159
+                ]
160
+            },
161
+            "notification-url": "https://packagist.org/downloads/",
162
+            "license": [
163
+                "MIT"
164
+            ],
165
+            "authors": [
166
+                {
167
+                    "name": "Michael Dowling",
168
+                    "email": "mtdowling@gmail.com",
169
+                    "homepage": "https://github.com/mtdowling"
170
+                }
171
+            ],
172
+            "description": "PSR-7 message implementation",
173
+            "keywords": [
174
+                "http",
175
+                "message",
176
+                "stream",
177
+                "uri"
178
+            ],
179
+            "time": "2016-06-24 23:00:38"
180
+        },
181
+        {
182
+            "name": "psr/http-message",
183
+            "version": "1.0.1",
184
+            "source": {
185
+                "type": "git",
186
+                "url": "https://github.com/php-fig/http-message.git",
187
+                "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
188
+            },
189
+            "dist": {
190
+                "type": "zip",
191
+                "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
192
+                "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
193
+                "shasum": ""
194
+            },
195
+            "require": {
196
+                "php": ">=5.3.0"
197
+            },
198
+            "type": "library",
199
+            "extra": {
200
+                "branch-alias": {
201
+                    "dev-master": "1.0.x-dev"
202
+                }
203
+            },
204
+            "autoload": {
205
+                "psr-4": {
206
+                    "Psr\\Http\\Message\\": "src/"
207
+                }
208
+            },
209
+            "notification-url": "https://packagist.org/downloads/",
210
+            "license": [
211
+                "MIT"
212
+            ],
213
+            "authors": [
214
+                {
215
+                    "name": "PHP-FIG",
216
+                    "homepage": "http://www.php-fig.org/"
217
+                }
218
+            ],
219
+            "description": "Common interface for HTTP messages",
220
+            "homepage": "https://github.com/php-fig/http-message",
221
+            "keywords": [
222
+                "http",
223
+                "http-message",
224
+                "psr",
225
+                "psr-7",
226
+                "request",
227
+                "response"
228
+            ],
229
+            "time": "2016-08-06 14:39:51"
230
+        },
231
+        {
232
+            "name": "vlucas/phpdotenv",
233
+            "version": "v2.3.0",
234
+            "source": {
235
+                "type": "git",
236
+                "url": "https://github.com/vlucas/phpdotenv.git",
237
+                "reference": "9ca5644c536654e9509b9d257f53c58630eb2a6a"
238
+            },
239
+            "dist": {
240
+                "type": "zip",
241
+                "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/9ca5644c536654e9509b9d257f53c58630eb2a6a",
242
+                "reference": "9ca5644c536654e9509b9d257f53c58630eb2a6a",
243
+                "shasum": ""
244
+            },
245
+            "require": {
246
+                "php": ">=5.3.9"
247
+            },
248
+            "require-dev": {
249
+                "phpunit/phpunit": "^4.8 || ^5.0"
250
+            },
251
+            "type": "library",
252
+            "extra": {
253
+                "branch-alias": {
254
+                    "dev-master": "2.3-dev"
255
+                }
256
+            },
257
+            "autoload": {
258
+                "psr-4": {
259
+                    "Dotenv\\": "src/"
260
+                }
261
+            },
262
+            "notification-url": "https://packagist.org/downloads/",
263
+            "license": [
264
+                "BSD-3-Clause-Attribution"
265
+            ],
266
+            "authors": [
267
+                {
268
+                    "name": "Vance Lucas",
269
+                    "email": "vance@vancelucas.com",
270
+                    "homepage": "http://www.vancelucas.com"
271
+                }
272
+            ],
273
+            "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
274
+            "keywords": [
275
+                "dotenv",
276
+                "env",
277
+                "environment"
278
+            ],
279
+            "time": "2016-06-14 14:14:52"
280
+        }
281
+    ],
282
+    "packages-dev": [],
283
+    "aliases": [],
284
+    "minimum-stability": "stable",
285
+    "stability-flags": [],
286
+    "prefer-stable": false,
287
+    "prefer-lowest": false,
288
+    "platform": [],
289
+    "platform-dev": []
290
+}

+ 2
- 0
example.env Zobrazit soubor

@@ -0,0 +1,2 @@
1
+SESSION=ffffffffffffffffff
2
+PERIOD=20161

+ 28
- 0
index.php Zobrazit soubor

@@ -0,0 +1,28 @@
1
+<?php
2
+
3
+require_once(__DIR__ . "/vendor/autoload.php");
4
+
5
+$dotenv = new Dotenv\Dotenv(__DIR__);
6
+$dotenv->load();
7
+
8
+header('Content-Type: text/html; charset=iso-8859');
9
+
10
+
11
+$cookie = new \GuzzleHttp\Cookie\SetCookie([
12
+  'Name' => 'PHPSESSID',
13
+  'Value' => getenv('SESSION'),
14
+  'Domain' => 'wprodl.uqac.ca'
15
+]);
16
+
17
+$jar = new \GuzzleHttp\Cookie\CookieJar(true);
18
+$jar->setCookie($cookie);
19
+
20
+$client = new GuzzleHttp\Client(['cookies' => true]);
21
+
22
+$response = $client->request('POST', 'https://wprodl.uqac.ca/dossier_etudiant/grille_horaire.html?type=gl', [
23
+    'cookies' => $jar,
24
+    'form_params' => [
25
+        'session' => getenv('PERIOD')
26
+    ]
27
+]);
28
+echo (string)$response->getBody();

Načítá se…
Zrušit
Uložit