From c17e5223a5cefeb942efb26fb0f069bb783884fc Mon Sep 17 00:00:00 2001 From: Dinesh Sailor Date: Fri, 5 Mar 2021 15:48:14 +0530 Subject: [PATCH 1/3] function used to find temp directory path --- src/Session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Session.php b/src/Session.php index c89ad46..83444da 100644 --- a/src/Session.php +++ b/src/Session.php @@ -546,7 +546,7 @@ public function getDefaultOptions() 'Accept-Encoding' => 'gzip', 'Accept' => '*/*', ], - 'curl' => [ CURLOPT_COOKIEFILE => tempnam('/tmp', 'phrets') ] + 'curl' => [ CURLOPT_COOKIEFILE => tempnam(sys_get_temp_dir(), 'phrets') ] ]; // disable following 'Location' header (redirects) automatically From 9c850c90a22571658fddb445aa417b6fba75d7a1 Mon Sep 17 00:00:00 2001 From: Dinesh Sailor Date: Mon, 8 Mar 2021 11:31:38 +0530 Subject: [PATCH 2/3] Cookie file fix --- src/Session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Session.php b/src/Session.php index 83444da..4858f40 100644 --- a/src/Session.php +++ b/src/Session.php @@ -546,7 +546,7 @@ public function getDefaultOptions() 'Accept-Encoding' => 'gzip', 'Accept' => '*/*', ], - 'curl' => [ CURLOPT_COOKIEFILE => tempnam(sys_get_temp_dir(), 'phrets') ] + 'curl' => [ CURLOPT_COOKIEFILE => '' ] // tempnam(sys_get_temp_dir(), 'phrets') leaving it black, create & delete cookie file automatically ]; // disable following 'Location' header (redirects) automatically From f66e3424071e5fce9850864db25e4cf5eef4a401 Mon Sep 17 00:00:00 2001 From: Dinesh Sailor Date: Mon, 8 Mar 2021 16:48:08 +0530 Subject: [PATCH 3/3] Handled Canada CREA Photo Download, its sending xml response with all photo url with getObject method --- src/Session.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/Session.php b/src/Session.php index 4858f40..35c52be 100644 --- a/src/Session.php +++ b/src/Session.php @@ -134,6 +134,34 @@ public function GetObject($resource, $type, $content_ids, $object_ids = '*', $lo if (stripos($response->getHeader('Content-Type'), 'multipart') !== false) { $parser = $this->grab(Strategy::PARSER_OBJECT_MULTIPLE); $collection = $parser->parse($response); + } + /** + * Canada CREA, sending xml response with all photo url + * + * #content_type: "text/xml" + * #content_id: null + * #object_id: null + * #mime_version: null + * #location: null + * #content_description: null + * #content_sub_description: null + * #content: """ + * \r\n + * \r\n + * \r\n + * \r\n + * \tResourceRecordID\tOrder\tMediaUrl\tMediaModificationTimestamp\t\r\n + * \t20317246\t1\thttps://ddfcdn.realtor.ca/listings/TS636850668860000000/reb8/highres/3/176463_1.jpg\t2019-02-06T16:21:26Z\t\r\n + * \t20317246\t2\thttps://ddfcdn.realtor.ca/listings/TS636852717980000000/reb8/highres/3/176463_2.jpg\t2019-02-09T01:16:38Z\t\r\n + * \t20317246\t3\thttps://ddfcdn.realtor.ca/listings/TS636852717980000000/reb8/highres/3/176463_3.jpg\t2019-02-09T01:16:38Z\t\r\n + * + * """ + * #preferred: null + * #error: null + */ + elseif (stripos($response->getHeader('Content-Type'), 'text/xml') !== false) { + $parser = $this->grab(Strategy::PARSER_SEARCH); + $collection = $parser->parse($this, $response, ['SearchType'=>'GetObject', 'Class' => 'Property']); } else { $collection = new Collection; $parser = $this->grab(Strategy::PARSER_OBJECT_SINGLE);