{"action":"created","issue":{"url":"https://api.github.com/repos/troydavisson/PHRETS/issues/90","repository_url":"https://api.github.com/repos/troydavisson/PHRETS","labels_url":"https://api.github.com/repos/troydavisson/PHRETS/issues/90/labels{/name}","comments_url":"https://api.github.com/repos/troydavisson/PHRETS/issues/90/comments","events_url":"https://api.github.com/repos/troydavisson/PHRETS/issues/90/events","html_url":"https://github.com/troydavisson/PHRETS/issues/90","id":115083704,"number":90,"title":"RFC: Enabling cookie files throughout a RETS session","user":{"login":"mariano","id":18598,"avatar_url":"https://avatars.githubusercontent.com/u/18598?v=3","gravatar_id":"","url":"https://api.github.com/users/mariano","html_url":"https://github.com/mariano","followers_url":"https://api.github.com/users/mariano/followers","following_url":"https://api.github.com/users/mariano/following{/other_user}","gists_url":"https://api.github.com/users/mariano/gists{/gist_id}","starred_url":"https://api.github.com/users/mariano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mariano/subscriptions","organizations_url":"https://api.github.com/users/mariano/orgs","repos_url":"https://api.github.com/users/mariano/repos","events_url":"https://api.github.com/users/mariano/events{/privacy}","received_events_url":"https://api.github.com/users/mariano/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-11-04T15:52:07Z","updated_at":"2016-06-09T15:57:52Z","closed_at":null,"body":"I have a wrapper on top of your library and [librets](https://github.com/NationalAssociationOfRealtors/libRETS) that allows me to connect to different RETS server using the same framework. I did this since I originally integrated the (binary) librets, but then decided to support PHRETS.\r\n\r\nFor almost every MLS both libraries worked. However just yesterday I hit a situation where I would see CRMLS working perfectly with librets, but not with PHRETS. Furthermore, your older PHRETS version ([the one you use](https://github.com/troydavisson/RETS-MD/blob/master/phrets.php) at [retsmd.com](http://www.retsmd.com)) was also working. After battling through ghosts and zombies, I narrowed it down to one difference: cookie files.\r\n\r\nI tried enabling cookie support in Guzzle through different means, most promising being `FileCookieJar`. Assuming `$this->session` is an instance of `PHRETS\\Session`, this is what I tried:\r\n\r\n```php\r\n$jar = new \\GuzzleHttp\\Cookie\\FileCookieJar(tempnam(null, 'phrets'));\r\n$this->session->setCookieJar($jar);\r\n```\r\n\r\nIt would still fail, though. I ended up with the following solution, which customizes CURL's cookie jar file directly:\r\n\r\n```php\r\n$this->session->getClient()->setDefaultOption('config', [\r\n    'curl' => [\r\n        CURLOPT_COOKIEFILE => tempnam(null, 'phrets')\r\n    ]\r\n]);\r\n```\r\n\r\nThis fixed the issue, and it's a generic solution which didn't affect any of the other MLS connections.\r\n\r\nI thought I left this here since other people may be battling with the same. If you think it's worth integrating this into the main session configuration somehow, I can work on a PR.\r\n"},"comment":{"url":"https://api.github.com/repos/troydavisson/PHRETS/issues/comments/224941050","html_url":"https://github.com/troydavisson/PHRETS/issues/90#issuecomment-224941050","issue_url":"https://api.github.com/repos/troydavisson/PHRETS/issues/90","id":224941050,"user":{"login":"gruler","id":19841120,"avatar_url":"https://avatars.githubusercontent.com/u/19841120?v=3","gravatar_id":"","url":"https://api.github.com/users/gruler","html_url":"https://github.com/gruler","followers_url":"https://api.github.com/users/gruler/followers","following_url":"https://api.github.com/users/gruler/following{/other_user}","gists_url":"https://api.github.com/users/gruler/gists{/gist_id}","starred_url":"https://api.github.com/users/gruler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gruler/subscriptions","organizations_url":"https://api.github.com/users/gruler/orgs","repos_url":"https://api.github.com/users/gruler/repos","events_url":"https://api.github.com/users/gruler/events{/privacy}","received_events_url":"https://api.github.com/users/gruler/received_events","type":"User","site_admin":false},"created_at":"2016-06-09T15:57:52Z","updated_at":"2016-06-09T15:57:52Z","body":"I need to make the above modifications to my code so I can use the PHRETS code to access CRMLS. I am having difficulty implementing it.\r\nCan somebody tell me how I should go about doing that?\r\nHere is a snippet that I tried, but this isn't right.\r\n\r\n$rets = new \\PHRETS\\Session($config);\r\n$rets->session->getClient()->setDefaultOption('config', [\r\n    'curl' => [\r\n        CURLOPT_COOKIEFILE => tempnam(null, 'phrets')\r\n    ]\r\n]);\r\n\r\nHow should I make this call?\r\n\r\nThanks for your help.\r\nJim"}}
{"actor":{"display_login":"gruler"}}