-
Notifications
You must be signed in to change notification settings - Fork 184
/
basic.php
34 lines (34 loc) · 887 Bytes
/
basic.php
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
<?php
require_once '_inc.php';
use Ares333\Curl\Toolkit;
$toolkit = new Toolkit();
$toolkit->setCurl();
$curl = $toolkit->getCurl();
$curl->onInfo = null;
$responseCode = null;
$curl->add(
array(
'opt' => array(
CURLOPT_URL => 'http://baidu.com'
),
'args' => array(
'This is user arg',
&$responseCode
)
),
function ($r, $args) {
$args[1] = $r['info']['http_code'];
echo "Request success for " . $r['info']['url'] . "\n";
echo "\nHeader info:\n";
print_r($r['info']);
echo "\nRaw header:\n";
print_r($r['header']);
echo "\nArgs:\n";
print_r($args);
echo "\n\nBody size:\n";
echo strlen($r['body']) . ' bytes';
echo "\n";
});
$curl->start();
echo "\nresponse code returned by reference:\n";
echo $responseCode . "\n";