Comments (6)
Good question. I'm looking at similarly facing these issues as we grow and need to be able to shift ETL processes to different colos as needed. Out of curiosity, and assuming that that your provider in question does not use HTTPS anywhere, could you setup your proxy server to rewrite incoming HTTP responses so that it can be used to rewrite the addresses in the headers of HTTP redirects? In other words (depending on your proxy software) you could have it rewrite http://retssystem.com/XYZ to http://retsproxy.myserver.com/XYZ for you.
from phrets.
Yeah, it can be done.
To make sure I totally understand what you're after, will the following work:
- Provide a
$rets->overrideHostWith()
method which allows you to pass in an alternate hostname - Any request (including the original Login) that references the real server would have it's hostname swapped with whatever the override is to instead send the request through the proxy
- PHRETS does this right before cURL calls are invoked so anything RETS specific is overridden
- No support or warranty as to the stability or working nature of this code and/or the proxy setup is provided
from phrets.
Ideally it should be able to allow for regex match and replace.
from phrets.
Ok. To anyone reading this now or in the future, using this feature without a complete understanding of what you're doing is NOT recommended.
I've pushed a commit (e8ffc8d) to the "proxy" branch which adds this. The new method accepts a callback as the only parameter. So after you instantiate your PHRETS object, do:
$rets->rewriteRequestURL(function ($url) {
// take $url and do something crazy to it
return $url;
});
from phrets.
(Submitted prematurely)
That function, if defined, will be called before every request is made by PHRETS. $url represents what it is about to use giving you a chance to do a regex replace or whatever before it fires. Whatever returns from that closure will be used as the URL.
from phrets.
Thanks @troydavisson. It works as expected. Allowing me to provide a function to manipulate the URL was smarter than my original suggestion of just allowing me to replace the domain, because I also need to change the port.
For anyone reading this, manipulating the URL was a real pain since I can't guarantee the systems running my code will have PECL, so I can't use its library for its convenient http_build_url
method. Instead I found this roll-your-own version.
from phrets.
Related Issues (20)
- php 8.x deprecated errors HOT 5
- Version of guzzlehttp/psr7 need to pe nailed to some specific version
- How do you update PHRETS? HOT 2
- PHPDocs
- ReplyCode 20203 HOT 1
- Remove default parameter in Response __call method
- RETS HOT 1
- I am not able to fetch the property image url with using ml_num. how to fetch properties image url? HOT 1
- Fetch all the data with area code
- PHP 8 HOT 2
- FLEX MLS starting pulling in all listings including closed HOT 1
- Undefined constant "PHRETS\CURLOPT_COOKIEFILE" at vendor/troydavisson/phrets/src/Session.php HOT 1
- What is STATUS=A in Query
- All the property are not getting downloaded.
- PHRETS 1.72 Question HOT 2
- Get Property Details
- Lots of tmp files HOT 1
- $rets->FreeResult($photos) not found HOT 2
- GetObject return Invalid header syntax error HOT 3
- Failing to get DDF data in STANDARD-XML format 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 phrets.