Fix "Warning: curl_setopt(): cannot represent a stream of type MEMORY as a STDIO FILE*"

This commit is contained in:
Zach Borboa
2014-12-30 17:04:10 -08:00
parent 5ac7f6f717
commit 4cb1436983
+8 -1
View File
@@ -438,7 +438,14 @@ class Curl
$ch = $_ch === null ? $this : $_ch;
$response_headers_fh = fopen('php://memory', 'wb+');
$ch->setOpt(CURLOPT_WRITEHEADER, $response_headers_fh);
// Fallback to storing data in a temporary file when storing data in
// memory errors with "Warning: curl_setopt(): cannot represent a stream
// of type MEMORY as a STDIO FILE*".
if (!@$ch->setOpt(CURLOPT_WRITEHEADER, $response_headers_fh)) {
$response_headers_fh = fopen('php://temp', 'wb+');
$ch->setOpt(CURLOPT_WRITEHEADER, $response_headers_fh);
}
if ($ch->multi_child) {
$ch->raw_response = curl_multi_getcontent($ch->curl);