diff --git a/.travis.yml b/.travis.yml index 337ed50..667f62d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,11 +6,13 @@ php: - 5.5 - 5.6 - 7.0 + - 7.1 - hhvm - nightly matrix: allow_failures: + - php: 7.1 - php: nightly before_script: diff --git a/examples/multi_curl_upload_file.php b/examples/multi_curl_upload_file.php new file mode 100644 index 0000000..51f0605 --- /dev/null +++ b/examples/multi_curl_upload_file.php @@ -0,0 +1,25 @@ +, +// then try uncommenting the following line: +// $multi_curl->setHeader('Content-Type', 'multipart/form-data'); + +$multi_curl->addPost('https://httpbin.org/post', array( + 'image' => new CURLFile('the-lorax.jpg'), +)); + +$multi_curl->addPost('https://httpbin.org/post', array( + 'image' => new CURLFile('swomee-swans.jpg'), +)); + +$multi_curl->addPost('https://httpbin.org/post', array( + 'image' => new CURLFile('truffula-trees.jpg'), +)); + +$multi_curl->start(); diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index 07853c0..c5776d7 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -350,7 +350,10 @@ class Curl // Include additional error code information in error message when possible. if ($this->curlError && function_exists('curl_strerror')) { - $this->curlErrorMessage = curl_strerror($this->curlErrorCode) . ': ' . $this->curlErrorMessage; + $this->curlErrorMessage = + curl_strerror($this->curlErrorCode) . ( + empty($this->curlErrorMessage) ? '' : ': ' . $this->curlErrorMessage + ); } $this->httpStatusCode = $this->getInfo(CURLINFO_HTTP_CODE);