Comments (6)
I'd be very interested in this, MLSGrid is only communicating on a compressed stream starting on Aug 14th.
from reso-webapi-client-php.
same! working with MLS Grid which requires compressed gzip.
from reso-webapi-client-php.
can anyone verify that #5 works?
from reso-webapi-client-php.
I forked this project for several reasons, this issue being one of them. I would be more than happy to push a PR.
from reso-webapi-client-php.
can anyone verify that #5 works?
I can verify that the modifications do in fact work for MLSGrid requests. The only other modification I had to do was to gzdecode() the returned data since for some reason that piece was not automatic.
from reso-webapi-client-php.
The simplest solution is to update the curl options to set CURLOPT_ACCEPT_ENCODING
. If this is set to an empty string, curl will automatically send the appropriate header based on the supported algorithms and automatically decode the response.
Sets the contents of the Accept-Encoding: header sent in an HTTP request, and enables decoding of a response when a Content-Encoding: header is received.
libcurl potentially supports several different compressed encodings depending on what support that has been built-in.
To aid applications not having to bother about what specific algorithms this particular libcurl build supports, libcurl allows a zero-length string to be set ("") to ask for an Accept-Encoding: header to be used that contains all built-in supported encodings.
This is the only change required for it to work correctly with MLSGrid (and any others, I'd guess), and it does not cause any problems with our other RESO providers:
diff --git a/lib/HttpClient/CurlClient.php b/lib/HttpClient/CurlClient.php
index f27f4c98f..53da6c1bf 100644
--- a/lib/HttpClient/CurlClient.php
+++ b/lib/HttpClient/CurlClient.php
@@ -173,6 +173,7 @@ public function request($method, $absUrl, $headers, $params, $hasFile)
$opts[CURLOPT_CONNECTTIMEOUT] = $this->connectTimeout;
$opts[CURLOPT_TIMEOUT] = $this->timeout;
$opts[CURLOPT_HEADERFUNCTION] = $headerCallback;
+ $opts[CURLOPT_ACCEPT_ENCODING] = '';
if($headers) {
$opts[CURLOPT_HTTPHEADER] = $headers;
}
From the curl docs:
This option was called CURLOPT_ENCODING before 7.21.6
The specific libcurl you are using must have been built with zlib to be able to decompress gzip and deflate responses, with the brotli library to decompress brotli responses and with the zstd library to decompress zstd responses.
from reso-webapi-client-php.
Related Issues (10)
- How to connect Bridge API (RESO API)
- Fatal error: Uncaught RESO\Error\Api: RESO\OpenIDConnect::requestAccessToken()
- FAQ does not exist HOT 1
- Difficulty Implementing Basic Use-Case HOT 1
- New to this HOT 10
- RESO Web Example Fails in Util.php HOT 2
- Memory leak HOT 5
- Best Practice Question... HOT 1
- Does not comply with psr-4 autoloading standard HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reso-webapi-client-php.