troydavisson / PHRETS

PHP client library for interacting with a RETS server to pull real estate listings, photos and other data made available from an MLS system
http://troda.com
MIT License
449 stars 235 forks source link

401 [reason phrase] RETS-Session-ID is invalid #111

Closed dhanya-dev closed 8 years ago

dhanya-dev commented 8 years ago

hi, Recently I have installed PHRETS 2.2 for downloading data but it is not working as I expected. For some servers i am facing the following issue while trying to download the data. Am I missing something here?

Uncaught GuzzleHttp\Exception\ClientException: Client error response [url] http://rets172lax.raprets.com:6123/Northtahoe/STAR/search.asp?SearchType=Property&Class=RES&Query=%28.........&QueryType=DMQL2&Count=1&Format=COMPACT-DECODED&Limit=99999999&StandardNames=0&Select=MLNumber [status code] 401 [reason phrase] RETS-Session-ID is invalid. in /var/www/factory/mls-project/php/SiFrameworks/phrets2.2/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:68 Stack trace:

0 /var/www/factory/mls-project/php/SiFrameworks/phrets2.2/vendor/guzzlehttp/guzzle/src/Subscriber/HttpError.php(31): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Message\Request), Object(GuzzleHttp\Message\Response))

1 /var/www/factory/mls-project/php/SiFrameworks/phrets2.2/vendor/guzzlehttp/guzzle/src/Event/Emitter.php(105): GuzzleHttp\Subscriber\HttpE in /var/www/factory/mls-project/php/SiFrameworks/phrets2.2/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 68

morr0350 commented 8 years ago

You may be required to set the User Agent in your session configuration (something like $config->setUserAgent('whateverUserAgentisRequired'); ) In our Rapattoni configurations, User Agent is always required. Rapattoni, or the real estate board you are working with, should have provided what they expect as the User Agent.

troydavisson commented 8 years ago

If the previous comment doesn't solve your issue, please re-open this. Otherwise, I'll assume (because my guess is, based on experience) this fixed it.

alfchee commented 6 years ago

@troydavisson I have the same problem reported by @dhanya-dev but even I'm setting the User Agent in the middle of getting data I'm getting the error, and also the client is ussing Rapattoni, then what can be causing me the error?

PHP Fatal error:  Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: `GET http://rets172lax.raprets.com:6103/Cincynky/CIN/getmetadata.aspx?Type=METADATA-LOOKUP_TYPE&ID=Property%3ACity&Format=STANDARD-XML` resulted in a `401 RETS-Session-ID is invalid.` response:
<RETS ReplyCode="20513" ReplyText="Miscellaneous error. RETS-Session-ID is invalid." />

' in /home/aggs/agg-mls/php-agg/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
Stack trace:
#0 /home/aggs/agg-mls/php-agg/vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))
#1 /home/aggs/agg-mls/php-agg/vendor/guzzlehttp/promises/src/Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#2 /home/aggs/agg-mls/php-agg/vendor/guzzlehttp/promises/src/Promise.php(156): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array)
#3 /home/aggs in /home/aggs/agg-mls/php-agg/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 113
acmwallace commented 6 years ago

@troydavisson - I am having the same issue, connecting to "Lexington-Bluegrass Association of REALTORS". I can log in fine, but get the error when trying to get system metadata. RETS-MD has no problem with this MLS, just the PHRETS library (1.7.2). Maybe the fact that the user agent in this case is just someones name ( "first last" )?