Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
vendor
vendor
.project
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
language: php

php:
- 5.4
- 5.5
- 5.6
- hhvm
- 7.0
- 7.1
- 7.2

before_script:
- composer self-update
Expand Down
17 changes: 9 additions & 8 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ Basic usage can be done using the `addUrl($url/*, $options*/)` method. This call
$mc = JMathai\PhpMultiCurl\MultiCurl::getInstance();

// Make a call to a URL.
$call1 = $mc->addUrl('http://slowapi.herokuapp.com/delay/2.0');
$call1 = $mc->addUrl('http://slowwly.robertomurray.co.uk/delay/2000/url/http://www.google.com');
// Make another call to a URL.
$call2 = $mc->addUrl('http://slowapi.herokuapp.com/delay/1.0');
$call2 = $mc->addUrl('http://slowwly.robertomurray.co.uk/delay/1000/url/http://www.google.com');

// Access the response for $call2.
// This blocks until $call2 is complete without waiting for $call1
Expand All @@ -59,9 +59,9 @@ This is what the output of that code will look like.
```
Call 2: consequatur id est
Call 1: in maiores et
(http://slowapi.herokuapp.com/delay/2.0 :: code=200, start=1447701285.5536, end=1447701287.9512, total=2.397534)
(http://slowwly.robertomurray.co.uk/delay/2000/url/http://www.google.com :: code=200, start=1447701285.5536, end=1447701287.9512, total=2.397534)
[====================================================================================================]
(http://slowapi.herokuapp.com/delay/1.0 :: code=200, start=1447701285.5539, end=1447701287.0871, total=1.532997)
(http://slowwly.robertomurray.co.uk/delay/1000/url/http://www.google.com :: code=200, start=1447701285.5539, end=1447701287.0871, total=1.532997)
[================================================================ ]
```

Expand All @@ -85,7 +85,7 @@ You'll most likely want to configure your cURL calls for your specific purpose.
$code = $call->code;
```

You can look at the [tests/example.php](https://github.com/jmathai/php-multi-curl/blob/master/src/example.php) file for working code and execute it from the command line.
You can look at the [example.php](https://github.com/jmathai/php-multi-curl/blob/master/example.php) file for working code and execute it from the command line.

## Documentation

Expand Down Expand Up @@ -152,8 +152,9 @@ echo $mc->getSequence()->renderAscii();
```

## Authors
* jmathai
* jmathai

### Contributors
* Lewis Cowles (LewisCowles1986) - Usability for adding url's without needing to worry about CURL, but provisioning also for specifying additional parameters
* Sam Thomson (samthomson) - Packaged it up
* Lewis Cowles ([LewisCowles1986](https://github.com/LewisCowles1986)) - Usability for adding url's without needing to worry about CURL, but provisioning also for specifying additional parameters
* Sam Thomson ([Samthomson](https://github.com/samthomson)) - Packaged it up
* Sławek Kaleta ([Dusta](https://github.com/dusta)) - Updated it up
7 changes: 4 additions & 3 deletions src/example.php → example.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env php
<?php
if (php_sapi_name() !== 'cli')
die();
if (php_sapi_name() !== 'cli') {
die();
}

require '../vendor/autoload.php';
require 'vendor/autoload.php';
$mc = JMathai\PhpMultiCurl\MultiCurl::getInstance();

$ch1 = curl_init('http://www.yahoo.com');
Expand Down
30 changes: 30 additions & 0 deletions src/Manager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
namespace JMathai\PhpMultiCurl;
/**
* Manager manages multicurl handles
*
* @author Jaisen Mathai <[email protected]>
*/
class Manager
{
private $_key;
private $_epiCurl;

public function __construct($key)
{
$this->_key = $key;
$this->_epiCurl = MultiCurl::getInstance();
}

public function __get($name)
{
$responses = $this->_epiCurl->getResult($this->_key);
return isset($responses[$name]) ? $responses[$name] : null;
}

public function __isset($name)
{
$val = self::__get($name);
return empty($val);
}
}
Loading