-
Notifications
You must be signed in to change notification settings - Fork 3
/
testing.multi.php
41 lines (30 loc) · 1.18 KB
/
testing.multi.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
35
36
37
38
39
<?php
require('../affilitest/API.php');
require('affilitest/APIMulti.php');
// You can replace "null" with your API key
// Concurrency of 5
$api = new AffiliTest\APIMulti(null, 5);
var_dump($api->login('<email>', '<password>'));
// Needed as curl saves cookies to disk only on curl_close
$api->closeCurl();
$offers = [
['http://tracking.com', 'us', AffiliTest\Devices::ANDROID],
['http://tracking.com', 'il', AffiliTest\Devices::IPHONE],
['http://tracking.com', 'it', AffiliTest\Devices::ANDROID],
['http://tracking.com', 'de', AffiliTest\Devices::IPHONE],
];
// A callback that will be called on every response
function onTestFinishedCallback(CurlX\RequestInterface $request) {
var_dump($request->response);
}
foreach ($offers as $offer) {
list($url, $country, $device) = $offer;
// Perform a regular test
$api->queueTest($url, $country, $device , 'onTestFinishedCallback');
}
foreach ($offers as $offer) {
list($url, $country, $device) = $offer;
// Perform a compare to preview test
$api->queueCompareToPreview($url, $country, $device, 'http://previewURL.com', 'onTestFinishedCallback');
}
$api->execute();