Fatal error: Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error response [url] https://rets.crmls.org/contact/rets/login [status code] 401 [reason phrase] Unauthorized' in C:\xampp\htdocs\ph-rets\vendor\guzzlehttp\gu

1,189 views
Skip to first unread message

nitin...@kayosys.com

unread,
Nov 17, 2015, 7:38:46 AM11/17/15
to PHRETS
n the connection that was succesfull i used settings auth is basic and i turned of verify peer and verify host off that prevent me from ssl cerificate error and i was abvle to login.
in another api i was unsuccessful to connect to i tried both basic and digest authentication method with verfiy peer and verify host off in curlfactory.php  in guzzlehttp/ringphp/src/client/


have i need to turn on ssl verify peer and host on?
then where could i get certificate??
or what can be the issue??


error:

Fatal error: Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error response [url] https://rets.crmls.org/contact/rets/login [status code] 401 [reason phrase] Unauthorized' in C:\xampp\htdocs\ph-rets\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php:89 Stack trace: #0 C:\xampp\htdocs\ph-rets\vendor\guzzlehttp\guzzle\src\Subscriber\HttpError.php(33): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Message\Request), Object(GuzzleHttp\Message\Response)) #1 C:\xampp\htdocs\ph-rets\vendor\guzzlehttp\guzzle\src\Event\Emitter.php(109): GuzzleHttp\Subscriber\HttpError->onComplete(Object(GuzzleHttp\Event\CompleteEvent), 'complete') #2 C:\xampp\htdocs\ph-rets\vendor\guzzlehttp\guzzle\src\RequestFsm.php(91): GuzzleHttp\Event\Emitter->emit('complete', Object(GuzzleHttp\Event\CompleteEvent)) #3 C:\xampp\htdocs\ph-rets\vendor\guzzlehttp\guzzle\src\RequestFsm.php(132): GuzzleHttp\RequestFsm->__invoke(Object(GuzzleHttp\Transaction)) #4 C:\xampp\htdocs\ph-rets\vendor\react\promise\sr in C:\xampp\htdocs\ph-rets\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php on line 89

Gennadiy Kofman

unread,
Nov 17, 2015, 12:45:54 PM11/17/15
to PHRETS
I've been having the same problem.  See this thread:

https://groups.google.com/forum/#!topic/phrets/seInzko3Yvg

The only solution I was able to find is to use phrets 1.x :(

Troy Davisson

unread,
Nov 17, 2015, 12:47:52 PM11/17/15
to PHRETS
Is http://retsmd.com/auth/ able to connect to it?

--
You received this message because you are subscribed to the Google Groups "PHRETS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phrets+un...@googlegroups.com.
To post to this group, send email to phr...@googlegroups.com.
Visit this group at http://groups.google.com/group/phrets.
For more options, visit https://groups.google.com/d/optout.

Gennadiy Kofman

unread,
Nov 17, 2015, 12:55:32 PM11/17/15
to PHRETS
Nope, didn't work for me.

Failed:  Using the credentials as given didn't work.
Failed:  Using HTTP Basic authentication was also unsuccessful.
Failed:  Using HTTP POST was also unsuccessful.
Failed:  Using HTTP POST + Basic auth was also unsuccessful.

nitin...@kayosys.com

unread,
Nov 18, 2015, 1:19:56 AM11/18/15
to PHRETS
ya the credentials failed

Failed:  Using the credentials as given didn't work.
Failed:  Using HTTP Basic authentication was also unsuccessful.
Failed:  Using HTTP POST was also unsuccessful.
Using HTTP POST + Basic auth was also unsuccessful.

but my uthentication type is digest is it testing for basic only?? or it test for digest too??

Nick Milosevic

unread,
Mar 7, 2016, 8:29:14 PM3/7/16
to PHRETS
I'm also experiencing the same 401 unauthorized error when trying to connect to CRMLS using the 2.x branch. Everything works fine in the 1.x branch, and retsmd.com is able to connect using the same credentials. retsmd.com/auth fails with the same errors that Gennadiy and Nitin had.


On Tuesday, November 17, 2015 at 9:47:52 AM UTC-8, Troy Davisson wrote:

Mariano Iglesias

unread,
Mar 8, 2016, 8:53:13 AM3/8/16
to phr...@googlegroups.com
Try enabling cookies like I specify here 

Nick Milosevic

unread,
Mar 8, 2016, 11:50:06 AM3/8/16
to phr...@googlegroups.com
that did the trick! Thank you for saving me from days of tracing/debugging!


--
You received this message because you are subscribed to a topic in the Google Groups "PHRETS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/phrets/mvqJEu1qWkc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to phrets+un...@googlegroups.com.

Gennadiy Kofman

unread,
Mar 9, 2016, 6:04:15 PM3/9/16
to PHRETS
You just became my idol.  I've spent many hours trying to figure this out.  Resorted to using 1.x branch to keep clients happy.
To unsubscribe from this group and stop receiving emails from it, send an email to phrets+unsubscribe@googlegroups.com.

Gennadiy Kofman

unread,
Jun 20, 2016, 2:03:05 PM6/20/16
to PHRETS
Mariano,

I'm running in to another issue relating to this.

CRMLS just came out with major changes, so I thought this would be a great time to upgrade to 2.x.

Running any one command using the cookie works great.  However, if I try to run $this->phrets->Login(); a second time, I get the Unauthorized error again.

The best solution that have worked so far is to not run Login again and just keep going.  But after a heavy workload (after about 50k records), I get the error again.  Most likely because my access timed out or something.

class Residential - 48500 entries processed so far

PHP
Fatal error:  Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error response [url] https://pt.rets.crmls.org/contact/rets/search?SearchType=Property&Class=Residential&Query=%28ModificationTimestamp%3D2016-06-10T09%3A24%3A00%2B%29&QueryType=DMQL2&Count=1&Format=COMPACT-DECODED&Limit=500&StandardNames=0&Offset=48501 [status code] 401 [reason phrase] Unauthorized' in /srv/rets/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:89



I set up a little test:

echo ' FIRST ';
        $this
->rets_login();

        echo
' SECOND ';
        $this
->rets_login();

        echo
' THIRD ';
        $this
->rets_login();

my rets_login() looks like this:

$this->phrets = new \PHRETS\Session($this->config);

        $loginConfigOptions
['curl'] = array(CURLOPT_COOKIEFILE => tempnam(null, 'phrets'));
        $this
->phrets->getClient()->setDefaultOption('config', $loginConfigOptions);

        $this
->phrets->Login();

My output looks like this:

FIRST  SECOND PHP Fatal error:  Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error response [url] https://pt.rets.crmls.org/contact/rets/login [status code] 401 [reason phrase] Unauthorized' in /srv/rets/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:89

I have tried unsetting the object, doing a Disconnect(), and changing the cookie name for each try.  Nothing worked so far.

Thanks for any ideas.

Gregg Moore

unread,
Jun 20, 2016, 2:27:30 PM6/20/16
to phr...@googlegroups.com
Without knowing your setup, I think you might have guessed it right. It looks to be timing out. Try breaking up the initial pull into classes (residential, lots & land, multi-family, etc).

Try disconnecting before logging back in.

Gregg Moore
Application Programmer/Web Developer
AT&T/iPhone :: 910.685.5055

Facebook :: facebook/GreggMoore23
Twitter :: MadRhino23

"Never trust a computer you can’t throw out a window."
Steve Wozniak

Mariano Iglesias

unread,
Jun 20, 2016, 2:34:27 PM6/20/16
to phr...@googlegroups.com
Yup. So:

1. Use limit and offset to process a small subset of records at a time. Something like 500.

2. Disconnect after each loop and then connect.
To unsubscribe from this group and stop receiving emails from it, send an email to phrets+un...@googlegroups.com.
To post to this group, send email to phr...@googlegroups.com.
Visit this group at https://groups.google.com/group/phrets.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "PHRETS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phrets+un...@googlegroups.com.
To post to this group, send email to phr...@googlegroups.com.
Visit this group at https://groups.google.com/group/phrets.
For more options, visit https://groups.google.com/d/optout.

Gregg Moore

unread,
Jun 20, 2016, 2:36:43 PM6/20/16
to phr...@googlegroups.com
You shouldn’t have to disconnect or login for each loop….

If this is your initial download, I suggest grabbing the property data then go back and grab the photos. Some feeds work great, others don’t. Blah….

Gregg Moore
Application Programmer/Web Developer
AT&T/iPhone :: 910.685.5055

Facebook :: facebook/GreggMoore23
Twitter :: MadRhino23

"Never trust a computer you can’t throw out a window."
Steve Wozniak

Gennadiy Kofman

unread,
Jun 20, 2016, 2:41:28 PM6/20/16
to PHRETS
Yep, I'm only processing 500 at a time.  The 48k is where it gives up.

And I've tried doing this (again my rets_login() function):

        if($this->connected){            
            echo
"Logging out";
            $this
->phrets->Disconnect();

       
}

        $this
->phrets = new \PHRETS\Session($this->config);

        $loginConfigOptions
['curl'] = array(CURLOPT_COOKIEFILE => tempnam(null, 'phrets'));
        $this
->phrets->getClient()->setDefaultOption('config', $loginConfigOptions);

        $this
->phrets->Login();


        $this
->connected = true;

Same result, I see FIRST SECOND and then the error.

Gregg, I do break up the process for different classes, however, Residential is the only one that takes a long time, the other ones are short and fast.
To unsubscribe from this group and stop receiving emails from it, send an email to phrets+unsubscribe@googlegroups.com.

To post to this group, send email to phr...@googlegroups.com.
Visit this group at https://groups.google.com/group/phrets.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "PHRETS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phrets+un...@googlegroups.com.
To post to this group, send email to phr...@googlegroups.com.
Visit this group at https://groups.google.com/group/phrets.
For more options, visit https://groups.google.com/d/optout.

Gennadiy Kofman

unread,
Jun 20, 2016, 2:44:58 PM6/20/16
to PHRETS
It's not the initial download, I had trouble with that too.  However this is an update for the last 10 days.  This was a test for bad case scenario.  I'm also concerned for my sanity checks (comparing their db with my) cause those are pretty time costly.
To unsubscribe from this group and stop receiving emails from it, send an email to phrets+unsubscribe@googlegroups.com.

To post to this group, send email to phr...@googlegroups.com.
Visit this group at https://groups.google.com/group/phrets.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "PHRETS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phrets+un...@googlegroups.com.
To post to this group, send email to phr...@googlegroups.com.
Visit this group at https://groups.google.com/group/phrets.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "PHRETS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phrets+un...@googlegroups.com.
To post to this group, send email to phr...@googlegroups.com.
Visit this group at https://groups.google.com/group/phrets.
For more options, visit https://groups.google.com/d/optout.

Gregg Moore

unread,
Jun 20, 2016, 2:46:44 PM6/20/16
to phr...@googlegroups.com
Yeah, updates should not take long at all…….

If you are comfortable with sending my your code, feel free to in  a separate email.
I’ll take a look at it for you.

Gregg Moore
Application Programmer/Web Developer
AT&T/iPhone :: 910.685.5055

Facebook :: facebook/GreggMoore23
Twitter :: MadRhino23

"Never trust a computer you can’t throw out a window."
Steve Wozniak

Reply all
Reply to author
Forward
0 new messages