예제 #1
0
<?php

require '../src/Curl/Curl.php';
require '../src/Curl/MultiCurl.php';
use ZzhhCurl\Curl;
use ZzhhCurl\MultiCurl;
$multi_curl = new MultiCurl();
$multi_curl->addGet('https://www.google.com/search', array('q' => 'hello world'));
$multi_curl->addGet('https://duckduckgo.com/', array('q' => 'hello world'));
$multi_curl->addGet('https://www.bing.com/search', array('q' => 'hello world'));
$multi_curl->start();
<?php

require '../src/Curl/Curl.php';
require '../src/Curl/MultiCurl.php';
use ZzhhCurl\Curl;
use ZzhhCurl\MultiCurl;
$multi_curl = new MultiCurl();
$multi_curl->addDownload('https://php.net/images/logos/php-med-trans.png', '/tmp/php-med-trans.png');
$multi_curl->addDownload('https://upload.wikimedia.org/wikipedia/commons/c/c1/PHP_Logo.png', '/tmp/PHP_Logo.png');
$multi_curl->start();
예제 #3
0
<?php

require '../src/Curl/Curl.php';
require '../src/Curl/MultiCurl.php';
use ZzhhCurl\Curl;
use ZzhhCurl\MultiCurl;
$multi_curl = new MultiCurl();
$multi_curl->addPut('https://httpbin.org/put', array('id' => '123', 'subject' => 'hello', 'body' => 'hello'));
$multi_curl->addPut('https://httpbin.org/put', array('id' => '456', 'subject' => 'hello', 'body' => 'hello'));
$multi_curl->start();
예제 #4
0
<?php

require '../src/Curl/Curl.php';
require '../src/Curl/MultiCurl.php';
use ZzhhCurl\Curl;
use ZzhhCurl\MultiCurl;
$multi_curl = new MultiCurl();
$multi_curl->addPatch('https://httpbin.org/patch', array('id' => '123', 'body' => 'hello world!'));
$multi_curl->addPatch('https://httpbin.org/patch', array('id' => '456', 'body' => 'hello world!'));
$multi_curl->start();
예제 #5
0
<?php

require '../src/Curl/Curl.php';
require '../src/Curl/MultiCurl.php';
use ZzhhCurl\Curl;
use ZzhhCurl\MultiCurl;
$multi_curl = new MultiCurl();
$multi_curl->addDelete('https://httpbin.org/delete', array('id' => '123'));
$multi_curl->addDelete('https://httpbin.org/delete', array('id' => '456'));
$multi_curl->start();
<?php

require '../src/Curl/Curl.php';
require '../src/Curl/MultiCurl.php';
use ZzhhCurl\Curl;
use ZzhhCurl\MultiCurl;
$multi_curl = new MultiCurl();
$multi_curl->success(function ($instance) {
    echo 'call to "' . $instance->url . '" was successful.' . "\n";
    echo 'response: ' . $instance->response . "\n";
});
$multi_curl->error(function ($instance) {
    echo 'call to "' . $instance->url . '" was unsuccessful.' . "\n";
    echo 'error code: ' . $instance->errorCode . "\n";
    echo 'error message: ' . $instance->errorMessage . "\n";
});
$multi_curl->complete(function ($instance) {
    echo 'call completed' . "\n";
});
$multi_curl->addGet('https://www.google.com/search', array('q' => 'hello world'));
$multi_curl->addGet('https://duckduckgo.com/', array('q' => 'hello world'));
$multi_curl->addGet('https://www.bing.com/search', array('q' => 'hello world'));
$multi_curl->start();
예제 #7
0
<?php

require '../src/Curl/Curl.php';
require '../src/Curl/MultiCurl.php';
use ZzhhCurl\Curl;
use ZzhhCurl\MultiCurl;
$multi_curl = new MultiCurl();
$multi_curl->addPost('https://httpbin.org/post', array('to' => 'alice', 'subject' => 'hi', 'body' => 'hi Alice'));
$multi_curl->addPost('https://httpbin.org/post', array('to' => 'bob', 'subject' => 'hi', 'body' => 'hi Bob'));
$multi_curl->start();