-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
54 lines (46 loc) · 1.33 KB
/
Copy pathindex.php
File metadata and controls
54 lines (46 loc) · 1.33 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
48
49
50
51
52
53
54
<?php
require 'class.php';
$init_time = time(); // reference
// new CrafyAsyncHttp({ABSOLUTE_PATH_TO_FOLDER_FOR_TEMP_FILES})
$classInstance = new CrafyAsyncHttp(__DIR__ . '/temp_files');
// for ($i=0; $i < 250; $i++) {
// $result = $classInstance->makeAsyncCurl(
// 'http://localhost/proyectos/CrafyAsyncHttp/test.php', // = CURLOPT_URL
// [
// "CURLOPT_POST" => true,
// "CURLOPT_POSTFIELDS" => json_encode([
// 'hello' => 'world',
// 'time' => time(),
// 'i' => $i
// ]),
// "CURLOPT_HTTPHEADER" => [
// "Content-Type: application/json"
// ],
// "CURLOPT_MAXREDIRS" => 10
// ] // = curl_setopt
// );
// var_dump($result); // true or false
// }
for ($i=0; $i < 20; $i++) {
$result = $classInstance->makeAsyncCurl_v2(
[
"CURLOPT_URL" => 'http://localhost/proyectos/CrafyAsyncHttp/test.php',
"CURLOPT_RETURNTRANSFER" => 1,
"CURLOPT_POST" => true,
"CURLOPT_POSTFIELDS" => json_encode([
'hello' => 'world',
'time' => time(),
'i' => $i
]),
"CURLOPT_HTTPHEADER" => [
"Content-Type: application/json"
],
"CURLOPT_MAXREDIRS" => 10
]
);
var_dump($result); // true or false
}
$end_time = time(); // reference
echo '<br>';
echo $end_time - $init_time; // (reference) Prints 0
?>